summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gzip.py
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2012-05-06 17:24:18 (GMT)
committerNadeem Vawda <nadeem.vawda@gmail.com>2012-05-06 17:24:18 (GMT)
commit11328e4437fc4972d45054078fa06bd9bc7a2d0a (patch)
tree572c5344f371ff54e5a51233ff902ad541a3cd69 /Lib/test/test_gzip.py
parentfe8440aec00af5bc2e995aaad205efa2e693a364 (diff)
downloadcpython-11328e4437fc4972d45054078fa06bd9bc7a2d0a.zip
cpython-11328e4437fc4972d45054078fa06bd9bc7a2d0a.tar.gz
cpython-11328e4437fc4972d45054078fa06bd9bc7a2d0a.tar.bz2
Really fix test_gzip failures on Windows.
Diffstat (limited to 'Lib/test/test_gzip.py')
-rw-r--r--Lib/test/test_gzip.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index d7b5d49..270411b 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -409,19 +409,20 @@ class TestOpen(BaseTest):
self.assertEqual(file_data, uncompressed * 2)
def test_text_modes(self):
- uncompressed = data1.decode("ascii").replace("\n", os.linesep) * 50
+ uncompressed = data1.decode("ascii") * 50
+ uncompressed_raw = uncompressed.replace("\n", os.linesep)
with gzip.open(self.filename, "wt") as f:
f.write(uncompressed)
with open(self.filename, "rb") as f:
file_data = gzip.decompress(f.read()).decode("ascii")
- self.assertEqual(file_data, uncompressed)
+ self.assertEqual(file_data, uncompressed_raw)
with gzip.open(self.filename, "rt") as f:
self.assertEqual(f.read(), uncompressed)
with gzip.open(self.filename, "at") as f:
f.write(uncompressed)
with open(self.filename, "rb") as f:
file_data = gzip.decompress(f.read()).decode("ascii")
- self.assertEqual(file_data, uncompressed * 2)
+ self.assertEqual(file_data, uncompressed_raw * 2)
def test_bad_params(self):
# Test invalid parameter combinations.
@@ -436,12 +437,13 @@ class TestOpen(BaseTest):
def test_encoding(self):
# Test non-default encoding.
- uncompressed = data1.decode("ascii").replace("\n", os.linesep) * 50
+ uncompressed = data1.decode("ascii") * 50
+ uncompressed_raw = uncompressed.replace("\n", os.linesep)
with gzip.open(self.filename, "wt", encoding="utf-16") as f:
f.write(uncompressed)
with open(self.filename, "rb") as f:
file_data = gzip.decompress(f.read()).decode("utf-16")
- self.assertEqual(file_data, uncompressed)
+ self.assertEqual(file_data, uncompressed_raw)
with gzip.open(self.filename, "rt", encoding="utf-16") as f:
self.assertEqual(f.read(), uncompressed)