summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gzip.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_gzip.py')
-rw-r--r--Lib/test/test_gzip.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index bb97097..af73953 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -355,6 +355,20 @@ class TestGzip(BaseTest):
with gzip.GzipFile(fileobj=f, mode="w") as g:
pass
+ def test_bytes_filename(self):
+ str_filename = self.filename
+ try:
+ bytes_filename = str_filename.encode("ascii")
+ except UnicodeEncodeError:
+ self.skipTest("Temporary file name needs to be ASCII")
+ with gzip.GzipFile(bytes_filename, "wb") as f:
+ f.write(data1 * 50)
+ with gzip.GzipFile(bytes_filename, "rb") as f:
+ self.assertEqual(f.read(), data1 * 50)
+ # Sanity check that we are actually operating on the right file.
+ with gzip.GzipFile(str_filename, "rb") as f:
+ self.assertEqual(f.read(), data1 * 50)
+
# Testing compress/decompress shortcut functions
def test_compress(self):