From fae2948db10fdfd8404ffa2ec08669e370c35f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Mond=C3=A9jar?= Date: Sat, 23 Jan 2021 12:38:47 +0100 Subject: [PATCH] Test angle by function --- tests/test_fx.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/test_fx.py b/tests/test_fx.py index c56d63004..9387bf142 100644 --- a/tests/test_fx.py +++ b/tests/test_fx.py @@ -523,6 +523,13 @@ def test_resize(): None, [["ABC", "ABC", "ABC", "ABC"], ["DEA", "CDE", "BCD", "ABC"]], ), + ( + lambda t: 90, + None, + None, + None, + [["ABC", "ABC", "ABC", "ABC"], ["DEA", "CDE", "BCD", "ABC"]], + ), ( 180, None, @@ -584,8 +591,12 @@ def test_rotate( # angles are defined in degrees, so convert to radians testing ``unit="rad"`` if unit == "rad": - angle = math.radians(angle) - + if hasattr(angle, "__call__"): + _angle = lambda t: math.radians(angle(0)) + else: + _angle = math.radians(angle) + else: + _angle = angle clip = BitmapClip(original_frames, fps=1) kwargs = { @@ -597,13 +608,13 @@ def test_rotate( } if resample not in ["bilinear", "nearest", "bicubic"]: with pytest.raises(ValueError) as exc: - clip.rotate(angle, **kwargs) + clip.rotate(_angle, **kwargs) assert ( "'resample' argument must be either 'bilinear', 'nearest' or 'bicubic'" ) == str(exc.value) return else: - rotated_clip = clip.rotate(angle, **kwargs) + rotated_clip = clip.rotate(_angle, **kwargs) expected_clip = BitmapClip(expected_frames, fps=1) assert rotated_clip.to_bitmap() == expected_clip.to_bitmap()