unpacking tests for "I" and "F" modes

This commit is contained in:
Alexander 2017-08-28 19:22:59 +03:00
parent aac0869ca7
commit 40fe1f721e

View File

@ -366,7 +366,6 @@ class TestLibUnpack(PillowTestCase):
self.assert_unpack("HSV", "V", 1, (0,0,1), (0,0,2), (0,0,3))
def test_I(self):
self.assert_unpack("I", "I", 4, 0x04030201, 0x08070605)
self.assert_unpack("I", "I;8", 1, 0x01, 0x02, 0x03, 0x04)
self.assert_unpack("I", "I;8S", b'\x01\x83', 1, -125)
self.assert_unpack("I", "I;16", 2, 0x0201, 0x0403)
@ -383,6 +382,7 @@ class TestLibUnpack(PillowTestCase):
-2097151999, 0x01000083)
if sys.byteorder == 'little':
self.assert_unpack("I", "I", 4, 0x04030201, 0x08070605)
self.assert_unpack("I", "I;16N", 2, 0x0201, 0x0403)
self.assert_unpack("I", "I;16NS", b'\x83\x01\x01\x83', 0x0183, -31999)
self.assert_unpack("I", "I;32N", 4, 0x04030201, 0x08070605)
@ -390,6 +390,7 @@ class TestLibUnpack(PillowTestCase):
b'\x83\x00\x00\x01\x01\x00\x00\x83',
0x01000083, -2097151999)
else:
self.assert_unpack("I", "I", 4, 0x01020304, 0x05060708)
self.assert_unpack("I", "I;16N", 2, 0x0102, 0x0304)
self.assert_unpack("I", "I;16NS", b'\x83\x01\x01\x83', -31999, 0x0183)
self.assert_unpack("I", "I;32N", 4, 0x01020304, 0x05060708)
@ -429,8 +430,6 @@ class TestLibUnpack(PillowTestCase):
-2097152000, 16777348)
def test_F_float(self):
self.assert_unpack("F", "F", 4,
1.539989614439558e-36, 4.063216068939723e-34)
self.assert_unpack("F", "F;32F", 4,
1.539989614439558e-36, 4.063216068939723e-34)
self.assert_unpack("F", "F;32BF", 4,
@ -443,12 +442,16 @@ class TestLibUnpack(PillowTestCase):
0.15000000596046448, -1234.5)
if sys.byteorder == 'little':
self.assert_unpack("F", "F", 4,
1.539989614439558e-36, 4.063216068939723e-34)
self.assert_unpack("F", "F;32NF", 4,
1.539989614439558e-36, 4.063216068939723e-34)
self.assert_unpack("F", "F;64NF",
b'333333\xc3?\x00\x00\x00\x00\x00J\x93\xc0',
0.15000000596046448, -1234.5)
else:
self.assert_unpack("F", "F", 4,
2.387939260590663e-38, 6.301941157072183e-36)
self.assert_unpack("F", "F;32NF", 4,
2.387939260590663e-38, 6.301941157072183e-36)
self.assert_unpack("F", "F;64NF",