[Python-3000-checkins] r55548 - python/branches/py3k-struni/Lib/test/test_bool.py python/branches/py3k-struni/Lib/test/test_bufio.py

guido.van.rossum python-3000-checkins at python.org
Thu May 24 18:11:25 CEST 2007


Author: guido.van.rossum
Date: Thu May 24 18:11:18 2007
New Revision: 55548

Modified:
   python/branches/py3k-struni/Lib/test/test_bool.py
   python/branches/py3k-struni/Lib/test/test_bufio.py
Log:
Fix test_bool and test_bufio.


Modified: python/branches/py3k-struni/Lib/test/test_bool.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_bool.py	(original)
+++ python/branches/py3k-struni/Lib/test/test_bool.py	Thu May 24 18:11:18 2007
@@ -26,10 +26,10 @@
 
     def test_print(self):
         try:
-            fo = open(test_support.TESTFN, "wb")
+            fo = open(test_support.TESTFN, "w")
             print(False, True, file=fo)
             fo.close()
-            fo = open(test_support.TESTFN, "rb")
+            fo = open(test_support.TESTFN, "r")
             self.assertEqual(fo.read(), 'False True\n')
         finally:
             fo.close()

Modified: python/branches/py3k-struni/Lib/test/test_bufio.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_bufio.py	(original)
+++ python/branches/py3k-struni/Lib/test/test_bufio.py	Thu May 24 18:11:18 2007
@@ -19,12 +19,12 @@
         try:
             # write once with \n and once without
             f.write(s)
-            f.write("\n")
+            f.write(b"\n")
             f.write(s)
             f.close()
             f = open(test_support.TESTFN, "rb")
             line = f.readline()
-            self.assertEqual(line, s + "\n")
+            self.assertEqual(line, s + b"\n")
             line = f.readline()
             self.assertEqual(line, s)
             line = f.readline()
@@ -48,16 +48,16 @@
             teststring = pattern * q + pattern[:r]
             self.assertEqual(len(teststring), length)
             self.try_one(teststring)
-            self.try_one(teststring + "x")
+            self.try_one(teststring + b"x")
             self.try_one(teststring[:-1])
 
     def test_primepat(self):
         # A pattern with prime length, to avoid simple relationships with
         # stdio buffer sizes.
-        self.drive_one("1234567890\00\01\02\03\04\05\06")
+        self.drive_one(b"1234567890\00\01\02\03\04\05\06")
 
     def test_nullpat(self):
-        self.drive_one("\0" * 1000)
+        self.drive_one(bytes(1000))
 
 def test_main():
     test_support.run_unittest(BufferSizeTest)


More information about the Python-3000-checkins mailing list