mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
4de5477b61
With the introduction and use of pytest, it is simple and easy to execute specific tests in isolation through documented command line arguments. Either by specifying the module path or through the `-k EXPRESSION` argument. There is no longer any need to provide the boilerplate: if __name__ == '__main__': unittest.main() To every test file. It is simply noise. The pattern remains in test files that aren't named with `test_*` as those files are not discovered and executed by pytest by default.
25 lines
813 B
Python
25 lines
813 B
Python
from .helper import PillowTestCase
|
|
|
|
from PIL import _binary
|
|
|
|
|
|
class TestBinary(PillowTestCase):
|
|
|
|
def test_standard(self):
|
|
self.assertEqual(_binary.i8(b'*'), 42)
|
|
self.assertEqual(_binary.o8(42), b'*')
|
|
|
|
def test_little_endian(self):
|
|
self.assertEqual(_binary.i16le(b'\xff\xff\x00\x00'), 65535)
|
|
self.assertEqual(_binary.i32le(b'\xff\xff\x00\x00'), 65535)
|
|
|
|
self.assertEqual(_binary.o16le(65535), b'\xff\xff')
|
|
self.assertEqual(_binary.o32le(65535), b'\xff\xff\x00\x00')
|
|
|
|
def test_big_endian(self):
|
|
self.assertEqual(_binary.i16be(b'\x00\x00\xff\xff'), 0)
|
|
self.assertEqual(_binary.i32be(b'\x00\x00\xff\xff'), 65535)
|
|
|
|
self.assertEqual(_binary.o16be(65535), b'\xff\xff')
|
|
self.assertEqual(_binary.o32be(65535), b'\x00\x00\xff\xff')
|