Skip to content

Commit 323f529

Browse files
committed
add test for Scale size list
1 parent efd1bfe commit 323f529

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/test_transforms.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,21 @@ def test_scale(self):
5959
transforms.Scale(osize),
6060
transforms.ToTensor(),
6161
])(img)
62-
# print img.size()
63-
# print 'output size:', osize
64-
# print result.size()
6562
assert osize in result.size()
6663
if height < width:
6764
assert result.size(1) <= result.size(2)
6865
elif width < height:
6966
assert result.size(1) >= result.size(2)
7067

68+
result = transforms.Compose([
69+
transforms.ToPILImage(),
70+
transforms.Scale([osize, osize]),
71+
transforms.ToTensor(),
72+
])(img)
73+
assert osize in result.size()
74+
assert result.size(1) == osize
75+
assert result.size(2) == osize
76+
7177
oheight = random.randint(5, 12) * 2
7278
owidth = random.randint(5, 12) * 2
7379
result = transforms.Compose([

0 commit comments

Comments
 (0)