File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -146,19 +146,19 @@ def test_doc(self):
146
146
self .failUnless (bytes .__doc__ .startswith ("bytes(" ))
147
147
148
148
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 ))
151
151
tfn = tempfile .mktemp ()
152
152
try :
153
153
# Prepare
154
154
with open (tfn , "wb" ) as f :
155
155
f .write (short_sample )
156
156
# Test readinto
157
157
with open (tfn , "rb" ) as f :
158
- b = bytes ([ ord ( 'x' )] * 20 )
158
+ b = b"x" * 20
159
159
n = f .readinto (b )
160
160
self .assertEqual (n , len (short_sample ))
161
- self .assertEqual (list ( b ), map ( ord , sample ) )
161
+ self .assertEqual (b , sample )
162
162
# Test writing in binary mode
163
163
with open (tfn , "wb" ) as f :
164
164
f .write (b )
You can’t perform that action at this time.
0 commit comments