Exemple #1
0
def test_save(tmp_path):
    temp_file = str(tmp_path / "temp.icns")

    with Image.open(TEST_FILE) as im:
        im.save(temp_file)

    with Image.open(temp_file) as reread:
        assert reread.mode == "RGBA"
        assert reread.size == (1024, 1024)
        assert reread.format == "ICNS"

    file_length = os.path.getsize(temp_file)
    with open(temp_file, "rb") as fp:
        fp.seek(4)
        assert _binary.i32be(fp.read(4)) == file_length
Exemple #2
0
    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')
Exemple #3
0
    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")
Exemple #4
0
def test_big_endian():
    assert _binary.i16be(b"\x00\x00\xff\xff") == 0
    assert _binary.i32be(b"\x00\x00\xff\xff") == 65535

    assert _binary.o16be(65535) == b"\xff\xff"
    assert _binary.o32be(65535) == b"\x00\x00\xff\xff"