Skip to content

Commit

Permalink
make sure passing a blank comment removes existing comment
Browse files Browse the repository at this point in the history
  • Loading branch information
smason committed Dec 3, 2022
1 parent e71f7c1 commit 1ed1a3a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Tests/test_file_jpeg.py
Expand Up @@ -98,6 +98,13 @@ def test_comment_write(self):
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()
Expand Down

0 comments on commit 1ed1a3a

Please sign in to comment.