Skip to content

Commit

Permalink
DOCTEST: Normalize whitespace for numpy > 1.13.1
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Sep 27, 2017
1 parent 9b8c4d9 commit 5636fe8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion nibabel/affines.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def append_diag(aff, steps, starts=()):
--------
>>> aff = np.eye(4)
>>> aff[:3,:3] = np.arange(9).reshape((3,3))
>>> append_diag(aff, [9, 10], [99,100])
>>> append_diag(aff, [9, 10], [99,100]) #doctest: +NORMALIZE_WHITESPACE
array([[ 0., 1., 2., 0., 0., 0.],
[ 3., 4., 5., 0., 0., 0.],
[ 6., 7., 8., 0., 0., 0.],
Expand Down
2 changes: 1 addition & 1 deletion nibabel/casting.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ def int_abs(arr):
128
>>> int_abs(np.array([-128, 127], dtype=np.int8))
array([128, 127], dtype=uint8)
>>> int_abs(np.array([-128, 127], dtype=np.float32))
>>> int_abs(np.array([-128, 127], dtype=np.float32)) #doctest: +NORMALIZE_WHITESPACE
array([ 128., 127.], dtype=float32)
"""
arr = np.array(arr, copy=False)
Expand Down
8 changes: 4 additions & 4 deletions nibabel/nicom/dwiparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def nearest_pos_semi_def(B):
Examples
--------
>>> B = np.diag([1, 1, -1])
>>> nearest_pos_semi_def(B)
>>> nearest_pos_semi_def(B) #doctest: +NORMALIZE_WHITESPACE
array([[ 0.75, 0. , 0. ],
[ 0. , 0.75, 0. ],
[ 0. , 0. , 0. ]])
Expand Down Expand Up @@ -145,11 +145,11 @@ def q2bg(q_vector, tol=1e-5):
Examples
--------
>>> q2bg([1, 0, 0])
>>> q2bg([1, 0, 0]) #doctest: +NORMALIZE_WHITESPACE
(1.0, array([ 1., 0., 0.]))
>>> q2bg([0, 10, 0])
>>> q2bg([0, 10, 0]) #doctest: +NORMALIZE_WHITESPACE
(10.0, array([ 0., 1., 0.]))
>>> q2bg([0, 0, 0])
>>> q2bg([0, 0, 0]) #doctest: +NORMALIZE_WHITESPACE
(0.0, array([ 0., 0., 0.]))
"""
q_vec = np.asarray(q_vector)
Expand Down
4 changes: 2 additions & 2 deletions nibabel/nifti1.py
Original file line number Diff line number Diff line change
Expand Up @@ -1938,13 +1938,13 @@ def set_sform(self, affine, code=None, **kwargs):
>>> data = np.arange(24).reshape((2,3,4))
>>> aff = np.diag([2, 3, 4, 1])
>>> img = Nifti1Pair(data, aff)
>>> img.get_sform()
>>> img.get_sform() #doctest: +NORMALIZE_WHITESPACE
array([[ 2., 0., 0., 0.],
[ 0., 3., 0., 0.],
[ 0., 0., 4., 0.],
[ 0., 0., 0., 1.]])
>>> saff, code = img.get_sform(coded=True)
>>> saff
>>> saff #doctest: +NORMALIZE_WHITESPACE
array([[ 2., 0., 0., 0.],
[ 0., 3., 0., 0.],
[ 0., 0., 4., 0.],
Expand Down
4 changes: 2 additions & 2 deletions nibabel/quaternions.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,13 @@ def quat2angle_axis(quat, identity_thresh=None):
>>> theta, vec = quat2angle_axis([0, 1, 0, 0])
>>> np.allclose(theta, np.pi)
True
>>> vec
>>> vec #doctest: +NORMALIZE_WHITESPACE
array([ 1., 0., 0.])
If this is an identity rotation, we return a zero angle and an
arbitrary vector
>>> quat2angle_axis([1, 0, 0, 0])
>>> quat2angle_axis([1, 0, 0, 0]) #doctest: +NORMALIZE_WHITESPACE
(0.0, array([ 1., 0., 0.]))
Notes
Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_minc1.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_old_namespace():
# depending on whether the minc.py module is already imported in this
# test run.
if not previous_import:
assert_equal(warns.pop(0).category, FutureWarning)
assert_equal(warns.pop(0).category, DeprecationWarning)
from .. import Minc1Image, MincImage
assert_equal(warns, [])
# The import from old module is the same as that from new
Expand Down

0 comments on commit 5636fe8

Please sign in to comment.