Skip to content

Commit 5422f87

Browse files
committed
BF - more doctest 3 fixes
1 parent 6a40356 commit 5422f87

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

nibabel/volumeutils.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -388,16 +388,16 @@ def array_from_file(shape, in_dtype, infile, offset=0, order='F'):
388388
Examples
389389
--------
390390
>>> from StringIO import StringIO as BytesIO
391-
>>> str_io = BytesIO()
391+
>>> bio = BytesIO()
392392
>>> arr = np.arange(6).reshape(1,2,3)
393-
>>> str_io.write(arr.tostring('F'))
394-
>>> arr2 = array_from_file((1,2,3), arr.dtype, str_io)
393+
>>> _ = bio.write(arr.tostring('F')) # outputs no in python3
394+
>>> arr2 = array_from_file((1,2,3), arr.dtype, bio)
395395
>>> np.all(arr == arr2)
396396
True
397-
>>> str_io = BytesIO()
398-
>>> str_io.write(' ' * 10)
399-
>>> str_io.write(arr.tostring('F'))
400-
>>> arr2 = array_from_file((1,2,3), arr.dtype, str_io, 10)
397+
>>> bio = BytesIO()
398+
>>> _ = bio.write(' ' * 10) #2to3: line.replace(' ', b' ')
399+
>>> _ = bio.write(arr.tostring('F'))
400+
>>> arr2 = array_from_file((1,2,3), arr.dtype, bio, 10)
401401
>>> np.all(arr == arr2)
402402
True
403403
'''

0 commit comments

Comments
 (0)