Fixes for Python 3

This commit is contained in:
hugovk 2014-07-30 20:43:34 +03:00
parent 515bb6e14d
commit f5440cc3e1
2 changed files with 5 additions and 5 deletions

View File

@ -237,11 +237,11 @@ def getiptcinfo(im):
# extract the IPTC/NAA resource # extract the IPTC/NAA resource
try: try:
app = im.app["APP13"] app = im.app["APP13"]
if app[:14] == "Photoshop 3.0\x00": if app[:14] == b"Photoshop 3.0\x00":
app = app[14:] app = app[14:]
# parse the image resource block # parse the image resource block
offset = 0 offset = 0
while app[offset:offset+4] == "8BIM": while app[offset:offset+4] == b"8BIM":
offset += 4 offset += 4
# resource code # resource code
code = JpegImagePlugin.i16(app, offset) code = JpegImagePlugin.i16(app, offset)

View File

@ -38,8 +38,8 @@ class TestFileIptc(PillowTestCase):
# Assert # Assert
self.assertIsInstance(iptc, dict) self.assertIsInstance(iptc, dict)
self.assertEqual(iptc[(2, 90)], "Budapest") self.assertEqual(iptc[(2, 90)], b"Budapest")
self.assertEqual(iptc[(2, 101)], "Hungary") self.assertEqual(iptc[(2, 101)], b"Hungary")
# _FIXME: is_raw() is disabled. Should we remove it? # _FIXME: is_raw() is disabled. Should we remove it?
def test__is_raw_equal_zero(self): def test__is_raw_equal_zero(self):
@ -56,7 +56,7 @@ class TestFileIptc(PillowTestCase):
def test_i(self): def test_i(self):
# Arrange # Arrange
c = "a" c = b"a"
# Act # Act
ret = IptcImagePlugin.i(c) ret = IptcImagePlugin.i(c)