Skip to content

Commit 7754ae7

Browse files
committed
Add test
1 parent 4907cde commit 7754ae7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/test_transform_ops.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,16 @@ def test_center_crop_torchvision(
199199
frame_tv = v2.CenterCrop(size=(height, width))(frame_full)
200200
assert_frames_equal(frame_center_crop, frame_tv)
201201

202+
def test_center_crop_fails(self):
203+
with pytest.raises(
204+
ValueError,
205+
match=r"must have a \(height, width\) pair for the size",
206+
):
207+
VideoDecoder(
208+
NASA_VIDEO.path,
209+
transforms=[torchcodec.transforms.CenterCrop(size=(100,))],
210+
)
211+
202212
@pytest.mark.parametrize(
203213
"height_scaling_factor, width_scaling_factor",
204214
((0.5, 0.5), (0.25, 0.1), (1.0, 1.0), (0.15, 0.75)),
@@ -302,7 +312,7 @@ def test_random_crop_nhwc(
302312
),
303313
),
304314
)
305-
def test_crop_fails(self, error_message, params):
315+
def test_random_crop_fails(self, error_message, params):
306316
with pytest.raises(
307317
ValueError,
308318
match=error_message,

0 commit comments

Comments
 (0)