Skip to content

Commit 75d6f1a

Browse files
committed
Fix tset_bytes.py.
1 parent eceb0fb commit 75d6f1a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Lib/test/test_bytes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,19 @@ def test_doc(self):
146146
self.failUnless(bytes.__doc__.startswith("bytes("))
147147

148148
def test_buffer_api(self):
149-
short_sample = "Hello world\n"
150-
sample = short_sample + "x"*(20 - len(short_sample))
149+
short_sample = b"Hello world\n"
150+
sample = short_sample + b"x"*(20 - len(short_sample))
151151
tfn = tempfile.mktemp()
152152
try:
153153
# Prepare
154154
with open(tfn, "wb") as f:
155155
f.write(short_sample)
156156
# Test readinto
157157
with open(tfn, "rb") as f:
158-
b = bytes([ord('x')]*20)
158+
b = b"x"*20
159159
n = f.readinto(b)
160160
self.assertEqual(n, len(short_sample))
161-
self.assertEqual(list(b), map(ord, sample))
161+
self.assertEqual(b, sample)
162162
# Test writing in binary mode
163163
with open(tfn, "wb") as f:
164164
f.write(b)

0 commit comments

Comments
 (0)