summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gzip.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-10-12 19:23:28 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-10-12 19:23:28 (GMT)
commit54edfb3eef77b2b6816e1790c38b39c53bfdc408 (patch)
tree3b0681af8b990213de1c916aec36833470e9201c /Lib/test/test_gzip.py
parent55bf20ad6e0bd9ca4c1b1a6dd7339972b4aa915e (diff)
downloadcpython-54edfb3eef77b2b6816e1790c38b39c53bfdc408.zip
cpython-54edfb3eef77b2b6816e1790c38b39c53bfdc408.tar.gz
cpython-54edfb3eef77b2b6816e1790c38b39c53bfdc408.tar.bz2
Issue #13664: GzipFile now supports non-ascii Unicode filenames.
Diffstat (limited to 'Lib/test/test_gzip.py')
-rw-r--r--Lib/test/test_gzip.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index aa56ed3..9713061 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -30,6 +30,17 @@ class TestGzip(unittest.TestCase):
def tearDown(self):
test_support.unlink(self.filename)
+ @test_support.requires_unicode
+ def test_unicode_filename(self):
+ unicode_filename = test_support.TESTFN_UNICODE
+ with gzip.GzipFile(unicode_filename, "wb") as f:
+ f.write(data1 * 50)
+ with gzip.GzipFile(unicode_filename, "rb") as f:
+ self.assertEqual(f.read(), data1 * 50)
+ # Sanity check that we are actually operating on the right file.
+ with open(unicode_filename, 'rb') as fobj, \
+ gzip.GzipFile(fileobj=fobj, mode="rb") as f:
+ self.assertEqual(f.read(), data1 * 50)
def test_write(self):
with gzip.GzipFile(self.filename, 'wb') as f: