mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 09:14:27 +03:00
Fix tests which are hardcoded for little-endian CPUs
This commit is contained in:
parent
c20d24e421
commit
2a2a1ea144
|
@ -10,8 +10,8 @@ def test_toarray():
|
|||
return ai["shape"], ai["typestr"], len(ai["data"])
|
||||
# assert_equal(test("1"), ((100, 128), '|b1', 1600))
|
||||
assert_equal(test("L"), ((100, 128), '|u1', 12800))
|
||||
assert_equal(test("I"), ((100, 128), '<i4', 51200)) # FIXME: wrong?
|
||||
assert_equal(test("F"), ((100, 128), '<f4', 51200)) # FIXME: wrong?
|
||||
assert_equal(test("I"), ((100, 128), Image._ENDIAN + 'i4', 51200)) # FIXME: wrong?
|
||||
assert_equal(test("F"), ((100, 128), Image._ENDIAN + 'f4', 51200)) # FIXME: wrong?
|
||||
assert_equal(test("RGB"), ((100, 128, 3), '|u1', 38400))
|
||||
assert_equal(test("RGBA"), ((100, 128, 4), '|u1', 51200))
|
||||
assert_equal(test("RGBX"), ((100, 128, 4), '|u1', 51200))
|
||||
|
|
|
@ -18,6 +18,8 @@ def test_pack():
|
|||
else:
|
||||
return [ord(c) for c in im.tobytes("raw", rawmode)]
|
||||
|
||||
order = 1 if Image._ENDIAN == '<' else -1
|
||||
|
||||
assert_equal(pack("1", "1"), [128])
|
||||
assert_equal(pack("1", "1;I"), [0])
|
||||
assert_equal(pack("1", "1;R"), [1])
|
||||
|
@ -25,9 +27,9 @@ def test_pack():
|
|||
|
||||
assert_equal(pack("L", "L"), [1])
|
||||
|
||||
assert_equal(pack("I", "I"), [1, 0, 0, 0])
|
||||
assert_equal(pack("I", "I"), [1, 0, 0, 0][::order])
|
||||
|
||||
assert_equal(pack("F", "F"), [0, 0, 128, 63])
|
||||
assert_equal(pack("F", "F"), [0, 0, 128, 63][::order])
|
||||
|
||||
assert_equal(pack("LA", "LA"), [1, 2])
|
||||
|
||||
|
|
|
@ -84,10 +84,12 @@ def test_tobytes():
|
|||
def tobytes(mode):
|
||||
return Image.new(mode, (1, 1), 1).tobytes()
|
||||
|
||||
order = 1 if Image._ENDIAN == '<' else -1
|
||||
|
||||
assert_equal(tobytes("L"), b"\x01")
|
||||
assert_equal(tobytes("I;16"), b"\x01\x00")
|
||||
assert_equal(tobytes("I;16B"), b"\x00\x01")
|
||||
assert_equal(tobytes("I"), b"\x01\x00\x00\x00")
|
||||
assert_equal(tobytes("I"), b"\x01\x00\x00\x00"[::order])
|
||||
|
||||
|
||||
def test_convert():
|
||||
|
|
Loading…
Reference in New Issue
Block a user