Skip to content

Commit

Permalink
Fixed exceptions when closing AppendingTiffWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jan 30, 2025
1 parent e4f2a4a commit d663404
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Tests/test_file_tiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,13 +783,17 @@ def test_appending_tiff_writer_writelong(self) -> None:
a.writeLong(2**32 - 1)
assert b.getvalue() == data + b"\xff\xff\xff\xff"

a.isFirst = True

def test_appending_tiff_writer_rewritelastshorttolong(self) -> None:
data = b"II\x2A\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
b = BytesIO(data)
with TiffImagePlugin.AppendingTiffWriter(b) as a:
a.rewriteLastShortToLong(2**32 - 1)
assert b.getvalue() == data[:-2] + b"\xff\xff\xff\xff"

a.isFirst = True

def test_saving_icc_profile(self, tmp_path: Path) -> None:
# Tests saving TIFF with icc_profile set.
# At the time of writing this will only work for non-compressed tiffs
Expand Down

0 comments on commit d663404

Please sign in to comment.