don't use bare asserts, don't mask file builtin with local

This commit is contained in:
wiredfool 2014-01-20 13:34:48 -08:00
parent e1e64904c7
commit 0492409def

View File

@ -255,22 +255,22 @@ def test_save_icc_profile_none():
# check saving files with an ICC profile set to None (omit profile)
in_file = "Tests/images/icc_profile_none.png"
im = Image.open(in_file)
assert im.info['icc_profile'] is None
assert_equal(im.info['icc_profile'], None)
file = tempfile("temp.png")
assert_no_exception(lambda: im.save(file))
im = Image.open(file)
assert 'icc_profile' not in im.info
f = tempfile("temp.png")
assert_no_exception(lambda: im.save(f))
im = Image.open(f)
assert_false('icc_profile' in im.info)
def test_save_icc_profile_exists():
# check icc profile is kept during save()
in_file = "Tests/images/trollface.png"
im = Image.open(in_file)
orig_profile = im.info['icc_profile']
assert len(orig_profile) == 6636
assert_equal(len(orig_profile), 6636)
file = tempfile("temp.png")
assert_no_exception(lambda: im.save(file))
f = tempfile("temp.png")
assert_no_exception(lambda: im.save(f))
im = Image.open(file)
assert im.info['icc_profile'] == orig_profile
im = Image.open(f)
assert_equal(im.info['icc_profile'], orig_profile)