(self)
| 854 | self.assertEqual(read_message, message) |
| 855 | |
| 856 | def test_flush_modes(self): |
| 857 | # Make sure the argument to flush is properly passed to the |
| 858 | # zlib.compressobj; see issue GH-105808. |
| 859 | class FakeCompressor: |
| 860 | def __init__(self): |
| 861 | self.modes = [] |
| 862 | def compress(self, data): |
| 863 | return b'' |
| 864 | def flush(self, mode=-1): |
| 865 | self.modes.append(mode) |
| 866 | return b'' |
| 867 | b = io.BytesIO() |
| 868 | fc = FakeCompressor() |
| 869 | with gzip.GzipFile(fileobj=b, mode='w') as f: |
| 870 | f.compress = fc |
| 871 | f.flush() |
| 872 | f.flush(50) |
| 873 | f.flush(zlib_mode=100) |
| 874 | # The implicit close will also flush the compressor. |
| 875 | expected_modes = [ |
| 876 | zlib.Z_SYNC_FLUSH, |
| 877 | 50, |
| 878 | 100, |
| 879 | -1, |
| 880 | ] |
| 881 | self.assertEqual(fc.modes, expected_modes) |
| 882 | |
| 883 | def test_write_seek_write(self): |
| 884 | # Make sure that offset is up-to-date before seeking |
nothing calls this directly
no test coverage detected