Skip to content

Commit da5fc4a

Browse files
committed
Potentially remove path exists checks from tests
1 parent 58aa143 commit da5fc4a

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

test/test_utils.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,6 @@ def test_draw_boxes():
102102
result = utils.draw_bounding_boxes(img, boxes, labels=labels, colors=colors, fill=True)
103103

104104
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "assets", "fakedata", "draw_boxes_util.png")
105-
if not os.path.exists(path):
106-
res = Image.fromarray(result.permute(1, 2, 0).contiguous().numpy())
107-
res.save(path)
108-
109105
if PILLOW_VERSION >= (10, 1):
110106
# The reference image is only valid for new PIL versions
111107
expected = torch.as_tensor(np.array(Image.open(path))).permute(2, 0, 1)
@@ -132,10 +128,6 @@ def test_draw_boxes_vanilla():
132128
result = utils.draw_bounding_boxes(img, boxes, fill=False, width=7, colors="white")
133129

134130
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "assets", "fakedata", "draw_boxes_vanilla.png")
135-
if not os.path.exists(path):
136-
res = Image.fromarray(result.permute(1, 2, 0).contiguous().numpy())
137-
res.save(path)
138-
139131
expected = torch.as_tensor(np.array(Image.open(path))).permute(2, 0, 1)
140132
assert_equal(result, expected)
141133
# Check if modification is not in place
@@ -329,10 +321,6 @@ def test_draw_keypoints_vanilla():
329321
],
330322
)
331323
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "assets", "fakedata", "draw_keypoint_vanilla.png")
332-
if not os.path.exists(path):
333-
res = Image.fromarray(result.permute(1, 2, 0).contiguous().numpy())
334-
res.save(path)
335-
336324
expected = torch.as_tensor(np.array(Image.open(path))).permute(2, 0, 1)
337325
assert_equal(result, expected)
338326
# Check that keypoints are not modified inplace
@@ -394,10 +382,6 @@ def test_draw_keypoints_visibility(connectivity, vis):
394382
path = os.path.join(
395383
os.path.dirname(os.path.abspath(__file__)), "assets", "fakedata", "draw_keypoints_visibility.png"
396384
)
397-
if not os.path.exists(path):
398-
res = Image.fromarray(result.permute(1, 2, 0).contiguous().numpy())
399-
res.save(path)
400-
401385
expected = torch.as_tensor(np.array(Image.open(path))).permute(2, 0, 1)
402386
assert_equal(result, expected)
403387

0 commit comments

Comments
 (0)