mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Mode F and I tests for Image.putdata
This commit is contained in:
parent
78d2618064
commit
1a245a577b
|
@ -46,6 +46,26 @@ class TestImagePutData(PillowTestCase):
|
|||
im = Image.new('L', (256,256))
|
||||
im.putdata(list(range(256))*256)
|
||||
|
||||
def test_mode_i(self):
|
||||
src = lena('L')
|
||||
data = list(src.getdata())
|
||||
im = Image.new('I', src.size, 0)
|
||||
im.putdata(data, 2, 256)
|
||||
|
||||
target = [2* elt + 256 for elt in data]
|
||||
self.assertEqual(list(im.getdata()), target)
|
||||
|
||||
def test_mode_F(self):
|
||||
src = lena('L')
|
||||
data = list(src.getdata())
|
||||
im = Image.new('F', src.size, 0)
|
||||
im.putdata(data, 2.0, 256.0)
|
||||
|
||||
target = [2.0* float(elt) + 256.0 for elt in data]
|
||||
self.assertEqual(list(im.getdata()), target)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user