[Python-3000-checkins] r55946 - in python/branches/py3k-struni: Lib/test/test_bz2.py Modules/bz2module.c

guido.van.rossum python-3000-checkins at python.org
Wed Jun 13 03:46:34 CEST 2007


Author: guido.van.rossum
Date: Wed Jun 13 03:46:31 2007
New Revision: 55946

Modified:
   python/branches/py3k-struni/Lib/test/test_bz2.py
   python/branches/py3k-struni/Modules/bz2module.c
Log:
Fix bz2_test.py by removing the tests for universal newline mode.
If you want text support, wrap a TextIOWrapper around it.
Remove references to universal newlines from the BZ2File docstring.


Modified: python/branches/py3k-struni/Lib/test/test_bz2.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_bz2.py	(original)
+++ python/branches/py3k-struni/Lib/test/test_bz2.py	Wed Jun 13 03:46:31 2007
@@ -112,22 +112,6 @@
         self.assertEqual(list(iter(bz2f)), sio.readlines())
         bz2f.close()
 
-    def testUniversalNewlinesLF(self):
-        # "Test BZ2File.read() with universal newlines (\\n)"
-        self.createTempFile()
-        bz2f = BZ2File(self.filename, "rU")
-        self.assertEqual(bz2f.read(), self.TEXT)
-        self.assertEqual(bz2f.newlines, b"\n")
-        bz2f.close()
-
-    def testUniversalNewlinesCRLF(self):
-        # "Test BZ2File.read() with universal newlines (\\r\\n)"
-        self.createTempFile(crlf=1)
-        bz2f = BZ2File(self.filename, "rU")
-        self.assertEqual(bz2f.read(), self.TEXT)
-        self.assertEqual(bz2f.newlines, b"\r\n")
-        bz2f.close()
-
     def testWrite(self):
         # "Test BZ2File.write()"
         bz2f = BZ2File(self.filename, "w")
@@ -240,16 +224,6 @@
         # "Test opening a nonexistent file"
         self.assertRaises(IOError, BZ2File, "/non/existent")
 
-    def testModeU(self):
-        # Bug #1194181: bz2.BZ2File opened for write with mode "U"
-        self.createTempFile()
-        bz2f = BZ2File(self.filename, "U")
-        bz2f.close()
-        f = open(self.filename, "rb")
-        f.seek(0, 2)
-        self.assertEqual(f.tell(), len(self.DATA))
-        f.close()
-
     def testBug1191043(self):
         # readlines() for files containing no newline
         data = b'BZh91AY&SY\xd9b\x89]\x00\x00\x00\x03\x80\x04\x00\x02\x00\x0c\x00 \x00!\x9ah3M\x13<]\xc9\x14\xe1BCe\x8a%t'

Modified: python/branches/py3k-struni/Modules/bz2module.c
==============================================================================
--- python/branches/py3k-struni/Modules/bz2module.c	(original)
+++ python/branches/py3k-struni/Modules/bz2module.c	Wed Jun 13 03:46:31 2007
@@ -1294,17 +1294,8 @@
 exist, and truncated otherwise. If the buffering argument is given, 0 means\n\
 unbuffered, and larger numbers specify the buffer size. If compresslevel\n\
 is given, must be a number between 1 and 9.\n\
-")
-PyDoc_STR(
-"\n\
-Add a 'U' to mode to open the file for input with universal newline\n\
-support. Any line ending in the input file will be seen as a '\\n' in\n\
-Python. Also, a file so opened gains the attribute 'newlines'; the value\n\
-for this attribute is one of None (no newline read yet), '\\r', '\\n',\n\
-'\\r\\n' or a tuple containing all the newline types seen. Universal\n\
-newlines are available only when reading.\n\
-")
-;
+Data read is always returned in bytes; data written ought to be bytes.\n\
+");
 
 static PyTypeObject BZ2File_Type = {
 	PyObject_HEAD_INIT(NULL)


More information about the Python-3000-checkins mailing list