summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bytes.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-24 17:52:00 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-24 17:52:00 (GMT)
commit75d6f1a2faf287e0688eb835022352a19a043d49 (patch)
treeaa76516b47928040ecbd9999c0bc0023a261bb78 /Lib/test/test_bytes.py
parenteceb0fbb0a9d6645316b9f52206f204ceef82685 (diff)
downloadcpython-75d6f1a2faf287e0688eb835022352a19a043d49.zip
cpython-75d6f1a2faf287e0688eb835022352a19a043d49.tar.gz
cpython-75d6f1a2faf287e0688eb835022352a19a043d49.tar.bz2
Fix tset_bytes.py.
Diffstat (limited to 'Lib/test/test_bytes.py')
-rw-r--r--Lib/test/test_bytes.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index 9fdca7f..efb4c98 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -146,8 +146,8 @@ class BytesTest(unittest.TestCase):
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 @@ class BytesTest(unittest.TestCase):
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)