From 8d21ce1df799dce8608076050044bd8f37844234 Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Mon, 21 Oct 2013 22:53:35 +0000 Subject: [PATCH] py3k --- Tests/test_file_libtiff.py | 17 +++++++++++++---- Tests/test_file_tiff.py | 20 +++++++++++++------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py index 6b3ab114e..67e351530 100644 --- a/Tests/test_file_libtiff.py +++ b/Tests/test_file_libtiff.py @@ -112,8 +112,13 @@ def test_little_endian(): b = im.tobytes() # Bytes are in image native order (little endian) - assert_equal(b[0], b'\xe0') - assert_equal(b[1], b'\x01') + if py3: + assert_equal(b[0], ord(b'\xe0')) + assert_equal(b[1], ord(b'\x01')) + else: + assert_equal(b[0], b'\xe0') + assert_equal(b[1], b'\x01') + out = tempfile("temp.tif") out = "temp.le.tif" @@ -134,8 +139,12 @@ def test_big_endian(): b = im.tobytes() # Bytes are in image native order (big endian) - assert_equal(b[0], b'\x01') - assert_equal(b[1], b'\xe0') + if py3: + assert_equal(b[0], ord(b'\x01')) + assert_equal(b[1], ord(b'\xe0')) + else: + assert_equal(b[0], b'\x01') + assert_equal(b[1], b'\xe0') out = tempfile("temp.tif") im.save(out) diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index c88e103b4..88c1aa8fd 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -80,8 +80,13 @@ def test_little_endian(): b = im.tobytes() # Bytes are in image native order (little endian) - assert_equal(b[0], b'\xe0') - assert_equal(b[1], b'\x01') + if py3: + assert_equal(b[0], ord(b'\xe0')) + assert_equal(b[1], ord(b'\x01')) + else: + assert_equal(b[0], b'\xe0') + assert_equal(b[1], b'\x01') + def test_big_endian(): im = Image.open('Tests/images/12bit.MM.cropped.tif') @@ -91,8 +96,9 @@ def test_big_endian(): b = im.tobytes() # Bytes are in image native order (big endian) - assert_equal(b[0], b'\x01') - assert_equal(b[1], b'\xe0') - - - + if py3: + assert_equal(b[0], ord(b'\x01')) + assert_equal(b[1], ord(b'\xe0')) + else: + assert_equal(b[0], b'\x01') + assert_equal(b[1], b'\xe0')