Add test for the ImageOps.scale function

This commit is contained in:
Marco De Donno 2016-07-05 20:15:14 +02:00
parent c0eb87cac3
commit 7af3c4c3bc

View File

@ -78,6 +78,16 @@ class TestImageOps(PillowTestCase):
ImageOps.equalize(i.convert("P")) ImageOps.equalize(i.convert("P"))
ImageOps.equalize(i.convert("RGB")) ImageOps.equalize(i.convert("RGB"))
def test_scale(self):
# Test the scaling function
i = hopper("L").resize((50,50))
newimg = ImageOps.scale(i,2)
self.assertEqual(newimg.size, (100, 100))
newimg = ImageOps.scale(i,0.5)
self.assertEqual(newimg.size, (25, 25))
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()