make sure passing a blank comment removes existing comment

This commit is contained in:
Sam Mason 2022-12-03 15:07:37 +00:00
parent e71f7c1083
commit 1ed1a3a971
No known key found for this signature in database
GPG Key ID: 0D059A3A7ECA31DA

View File

@ -98,6 +98,13 @@ class TestFileJpeg:
with Image.open(out) as reloaded:
assert im.info["comment"] == reloaded.info["comment"]
# Ensure that a blank comment causes any existing comment to be removed
for comment in ("", b"", None):
out = BytesIO()
im.save(out, format="JPEG", comment=comment)
with Image.open(out) as reloaded:
assert "comment" not in reloaded.info
# Test that a comment argument overrides the default comment
for comment in ("Test comment text", b"Text comment text"):
out = BytesIO()