"src/vscode:/vscode.git/clone" did not exist on "e3a2c7f02cd9e47a9093efe3e9659c8e99e28aac"
Unverified Commit f33e387f authored by Gu Wang's avatar Gu Wang Committed by GitHub
Browse files

allow size to be generic Sequence in Resize (#7999)


Co-authored-by: default avatarNicolas Hug <contact@nicolas-hug.com>
Co-authored-by: default avatarNicolas Hug <nh.nicolas.hug@gmail.com>
parent a8c4875c
......@@ -699,7 +699,7 @@ class TestResize:
assert_equal(actual, expected)
def test_transform_unknown_size_error(self):
with pytest.raises(ValueError, match="size can either be an integer or a list or tuple of one or two integers"):
with pytest.raises(ValueError, match="size can either be an integer or a sequence of one or two integers"):
transforms.Resize(size=object())
@pytest.mark.parametrize(
......
......@@ -135,11 +135,11 @@ class Resize(Transform):
if isinstance(size, int):
size = [size]
elif isinstance(size, (list, tuple)) and len(size) in {1, 2}:
elif isinstance(size, Sequence) and len(size) in {1, 2}:
size = list(size)
else:
raise ValueError(
f"size can either be an integer or a list or tuple of one or two integers, " f"but got {size} instead."
f"size can either be an integer or a sequence of one or two integers, but got {size} instead."
)
self.size = size
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment