Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add test demonstrating GH-108111
  • Loading branch information
effigies committed Aug 22, 2023
commit aa32f84095e91d8ffeaf9b3a17ba6e0ef9f80c0b
12 changes: 12 additions & 0 deletions Lib/test/test_gzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,18 @@ def flush(self, mode=-1):
]
self.assertEqual(fc.modes, expected_modes)

def test_write_seek_write(self):
# Make sure that offset is up-to-date before seeking
# See issue GH-108111
b = io.BytesIO()
message = b"important message here."
with gzip.GzipFile(fileobj=b, mode='w') as f:
f.write(message)
f.seek(len(message))
f.write(message)
data = b.getvalue()
self.assertEqual(gzip.decompress(data), message * 2)


class TestOpen(BaseTest):
def test_binary_modes(self):
Expand Down