We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 28412d9 commit d7a619fCopy full SHA for d7a619f
nibabel/tests/test_volumeutils.py
@@ -103,7 +103,8 @@ def make_array(n, bytes):
103
# Read back from file
104
fobj_r = opener(fname, 'rb')
105
try:
106
- contents1 = fobj_r.read()
+ contents1 = bytearray(4 * n)
107
+ fobj_r.readinto(contents1)
108
# Second element is 1
109
assert_false(contents1[0:8] == b'\x00' * 8)
110
out_arr = make_array(n, contents1)
@@ -114,7 +115,8 @@ def make_array(n, bytes):
114
115
assert_equal(contents1[:8], b'\x00' * 8)
116
# Reread, to get unmodified contents
117
fobj_r.seek(0)
- contents2 = fobj_r.read()
118
+ contents2 = bytearray(4 * n)
119
+ fobj_r.readinto(contents2)
120
out_arr2 = make_array(n, contents2)
121
assert_array_equal(in_arr, out_arr2)
122
assert_equal(out_arr[1], 0)
0 commit comments