diff options
Diffstat (limited to 'Lib/test/test_gzip.py')
| -rw-r--r-- | Lib/test/test_gzip.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py index b417044..c0be3a1 100644 --- a/Lib/test/test_gzip.py +++ b/Lib/test/test_gzip.py @@ -6,6 +6,7 @@ from test import support import os import io import struct +import array gzip = support.import_module('gzip') data1 = b""" int length=DEFAULTALLOC, err = Z_OK; @@ -77,15 +78,18 @@ class TestGzip(BaseTest): def test_write_bytearray(self): self.write_and_read_back(bytearray(data1 * 50)) + def test_write_array(self): + self.write_and_read_back(array.array('I', data1 * 40)) + def test_write_incompatible_type(self): # Test that non-bytes-like types raise TypeError. # Issue #21560: attempts to write incompatible types # should not affect the state of the fileobject with gzip.GzipFile(self.filename, 'wb') as f: with self.assertRaises(TypeError): - f.write('a') + f.write('') with self.assertRaises(TypeError): - f.write([1]) + f.write([]) f.write(data1) with gzip.GzipFile(self.filename, 'rb') as f: self.assertEqual(f.read(), data1) |
