mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 02:36:17 +03:00
test, fix missing 'version' key value in __array_interface__
This commit is contained in:
parent
ba626ef504
commit
0ff05afa56
|
@ -622,6 +622,7 @@ class Image(object):
|
|||
new['shape'] = shape
|
||||
new['typestr'] = typestr
|
||||
new['data'] = self.tobytes()
|
||||
new['version'] = 3
|
||||
return new
|
||||
raise AttributeError(name)
|
||||
|
||||
|
|
|
@ -10,18 +10,18 @@ class TestImageArray(PillowTestCase):
|
|||
def test_toarray(self):
|
||||
def test(mode):
|
||||
ai = im.convert(mode).__array_interface__
|
||||
return ai["shape"], ai["typestr"], len(ai["data"])
|
||||
# self.assertEqual(test("1"), ((100, 128), '|b1', 1600))
|
||||
self.assertEqual(test("L"), ((100, 128), '|u1', 12800))
|
||||
return ai['version'], ai["shape"], ai["typestr"], len(ai["data"])
|
||||
# self.assertEqual(test("1"), (3, (100, 128), '|b1', 1600))
|
||||
self.assertEqual(test("L"), (3, (100, 128), '|u1', 12800))
|
||||
|
||||
# FIXME: wrong?
|
||||
self.assertEqual(test("I"), ((100, 128), Image._ENDIAN + 'i4', 51200))
|
||||
self.assertEqual(test("I"), (3, (100, 128), Image._ENDIAN + 'i4', 51200))
|
||||
# FIXME: wrong?
|
||||
self.assertEqual(test("F"), ((100, 128), Image._ENDIAN + 'f4', 51200))
|
||||
self.assertEqual(test("F"), (3, (100, 128), Image._ENDIAN + 'f4', 51200))
|
||||
|
||||
self.assertEqual(test("RGB"), ((100, 128, 3), '|u1', 38400))
|
||||
self.assertEqual(test("RGBA"), ((100, 128, 4), '|u1', 51200))
|
||||
self.assertEqual(test("RGBX"), ((100, 128, 4), '|u1', 51200))
|
||||
self.assertEqual(test("RGB"), (3, (100, 128, 3), '|u1', 38400))
|
||||
self.assertEqual(test("RGBA"), (3, (100, 128, 4), '|u1', 51200))
|
||||
self.assertEqual(test("RGBX"), (3, (100, 128, 4), '|u1', 51200))
|
||||
|
||||
def test_fromarray(self):
|
||||
def test(mode):
|
||||
|
|
Loading…
Reference in New Issue
Block a user