]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport montanaro's checkin of
authorMichael W. Hudson <mwh@python.net>
Fri, 23 Aug 2002 16:10:13 +0000 (16:10 +0000)
committerMichael W. Hudson <mwh@python.net>
Fri, 23 Aug 2002 16:10:13 +0000 (16:10 +0000)
    revision 1.9 of test_gzip.py

force gzip module to open files using 'b'inary mode.
closes patch #536278.

Lib/test/test_gzip.py

index a5660a9ec26b9ce636ca8ad5cc1f93900e8854ed..d42dee66678943b7236903f9e2161704904123e9 100644 (file)
@@ -18,7 +18,7 @@ data2 = """/* zlibmodule.c -- gzip-compatible data compression */
 
 f = gzip.GzipFile(filename, 'wb') ; f.write(data1 * 50) ; f.close()
 
-f = gzip.GzipFile(filename, 'rb') ; d = f.read() ; f.close()
+f = gzip.GzipFile(filename, 'r') ; d = f.read() ; f.close()
 verify(d == data1*50)
 
 # Append to the previous file
@@ -75,4 +75,8 @@ for pos in range(0, 256, 16):
     f.write('GZ\n')
 f.close()
 
+f = gzip.GzipFile(filename, 'r')
+verify(f.myfileobj.mode == 'rb')
+f.close()
+
 os.unlink(filename)