Skip to content

Commit 55ee3f1

Browse files
committed
TEST: Use legacy printing for numpy arrays
1 parent 1f49bbb commit 55ee3f1

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

nipype/conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import pytest
22
import numpy
33
import os
4+
from distutils.version import LooseVersion
45

56
DATADIR = os.path.realpath(
67
os.path.join(os.path.dirname(__file__), 'testing/data'))
@@ -19,3 +20,5 @@ def in_testing(request):
1920
# This seems to be a reliable way to distinguish tests from doctests
2021
if request.function is None:
2122
os.chdir(DATADIR)
23+
if LooseVersion(numpy.__version__) >= LooseVersion('1.14'):
24+
numpy.set_printoptions(legacy="1.13")

nipype/interfaces/image.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,21 @@ class Reorient(SimpleInterface):
6161
'segmentation0.nii.gz'
6262
6363
>>> print(np.loadtxt(res.outputs.transform))
64-
[[1. 0. 0. 0.]
65-
[0. 1. 0. 0.]
66-
[0. 0. 1. 0.]
67-
[0. 0. 0. 1.]]
64+
[[ 1. 0. 0. 0.]
65+
[ 0. 1. 0. 0.]
66+
[ 0. 0. 1. 0.]
67+
[ 0. 0. 0. 1.]]
6868
6969
>>> reorient.inputs.orientation = 'RAS'
7070
>>> res = reorient.run()
7171
>>> res.outputs.out_file # doctest: +ELLIPSIS
7272
'.../segmentation0_ras.nii.gz'
7373
7474
>>> print(np.loadtxt(res.outputs.transform))
75-
[[-1. 0. 0. 60.]
76-
[ 0. -1. 0. 72.]
77-
[ 0. 0. 1. 0.]
78-
[ 0. 0. 0. 1.]]
75+
[[ -1. 0. 0. 60.]
76+
[ 0. -1. 0. 72.]
77+
[ 0. 0. 1. 0.]
78+
[ 0. 0. 0. 1.]]
7979
8080
.. testcleanup::
8181

0 commit comments

Comments
 (0)