[Python-3000-checkins] r55556 - python/branches/py3k-struni/Lib/test/test_bytes.py

guido.van.rossum python-3000-checkins at python.org
Thu May 24 19:52:03 CEST 2007


Author: guido.van.rossum
Date: Thu May 24 19:52:00 2007
New Revision: 55556

Modified:
   python/branches/py3k-struni/Lib/test/test_bytes.py
Log:
Fix tset_bytes.py.


Modified: python/branches/py3k-struni/Lib/test/test_bytes.py
==============================================================================
--- python/branches/py3k-struni/Lib/test/test_bytes.py	(original)
+++ python/branches/py3k-struni/Lib/test/test_bytes.py	Thu May 24 19:52:00 2007
@@ -146,8 +146,8 @@
         self.failUnless(bytes.__doc__.startswith("bytes("))
 
     def test_buffer_api(self):
-        short_sample = "Hello world\n"
-        sample = short_sample + "x"*(20 - len(short_sample))
+        short_sample = b"Hello world\n"
+        sample = short_sample + b"x"*(20 - len(short_sample))
         tfn = tempfile.mktemp()
         try:
             # Prepare
@@ -155,10 +155,10 @@
                 f.write(short_sample)
             # Test readinto
             with open(tfn, "rb") as f:
-                b = bytes([ord('x')]*20)
+                b = b"x"*20
                 n = f.readinto(b)
             self.assertEqual(n, len(short_sample))
-            self.assertEqual(list(b), map(ord, sample))
+            self.assertEqual(b, sample)
             # Test writing in binary mode
             with open(tfn, "wb") as f:
                 f.write(b)


More information about the Python-3000-checkins mailing list