summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gzip.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-11-16 16:56:57 (GMT)
committerGitHub <noreply@github.com>2019-11-16 16:56:57 (GMT)
commita0652328a26757a90d63697b5c01f5427b1132b5 (patch)
tree6cd0b03474130783b7319cf94a4ec56f99e28eee /Lib/test/test_gzip.py
parentbd44a7ead9f7336d7bb45f186b2b6ca0300154f7 (diff)
downloadcpython-a0652328a26757a90d63697b5c01f5427b1132b5.zip
cpython-a0652328a26757a90d63697b5c01f5427b1132b5.tar.gz
cpython-a0652328a26757a90d63697b5c01f5427b1132b5.tar.bz2
bpo-28286: Deprecate opening GzipFile for writing implicitly. (GH-16417)
Always specify the mode argument for writing.
Diffstat (limited to 'Lib/test/test_gzip.py')
-rw-r--r--Lib/test/test_gzip.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index 48a36a3..57d851c 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -469,7 +469,9 @@ class TestGzip(BaseTest):
if "x" in mode:
support.unlink(self.filename)
with open(self.filename, mode) as f:
- with gzip.GzipFile(fileobj=f) as g:
+ with self.assertWarns(FutureWarning):
+ g = gzip.GzipFile(fileobj=f)
+ with g:
self.assertEqual(g.mode, gzip.WRITE)
def test_bytes_filename(self):