Skip to content

doctest AFNIHeader.get_data_scaling fails if ran "alone" #784

Closed
@yarikoptic

Description

@yarikoptic

originally reported in #782 but has nothing to do with the endianess, so filing separately

when I ran the full sweep using python -m nose -s -v --with-doctest nibabel 2>&1 | tee tests.log that doctest was reported as passed:

(sid_s390x-dchroot)yoh@zelenka:~/nibabel$ grep AFNIHeader.get_data_scaling  tests.log 
Doctest: nibabel.brikhead.AFNIHeader.get_data_scaling ... ok

but when I run only the doctest - it fails

(sid_s390x-dchroot)yoh@zelenka:~/nibabel$ python -m nose -s -v --with-doctest  nibabel/brikhead.py
Doctest: nibabel.brikhead.AFNIHeader.__init__ ... ok
Doctest: nibabel.brikhead.AFNIHeader.get_affine ... ok
Doctest: nibabel.brikhead.AFNIHeader.get_data_scaling ... FAIL
Doctest: nibabel.brikhead.AFNIHeader.get_volume_labels ... ok
Doctest: nibabel.brikhead.AFNIImage ... ok
Doctest: nibabel.brikhead._unpack_var ... ok
Doctest: nibabel.brikhead.parse_AFNI_header ... ok

======================================================================
FAIL: Doctest: nibabel.brikhead.AFNIHeader.get_data_scaling
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/doctest.py", line 2224, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for nibabel.brikhead.AFNIHeader.get_data_scaling
  File "/home/yoh/nibabel/nibabel/brikhead.py", line 414, in get_data_scaling

----------------------------------------------------------------------
File "/home/yoh/nibabel/nibabel/brikhead.py", line 422, in nibabel.brikhead.AFNIHeader.get_data_scaling
Failed example:
    header.get_data_scaling()
Expected:
    array([  3.88336300e-08])
Got:
    array([3.883363e-08])


----------------------------------------------------------------------
Ran 7 tests in 0.011s

that is numpy 1.16.2 . Happens to me also on my laptop (regular little endian amd64) with the same numpy

(git)hopa:~nipy-suite/nibabel[master]git
$> python -m nose -s -v --with-doctest  nibabel/brikhead.py
Doctest: nibabel.brikhead.AFNIHeader.__init__ ... ok
Doctest: nibabel.brikhead.AFNIHeader.get_affine ... ok
Doctest: nibabel.brikhead.AFNIHeader.get_data_scaling ... FAIL
Doctest: nibabel.brikhead.AFNIHeader.get_volume_labels ... ok
Doctest: nibabel.brikhead.AFNIImage ... ok
Doctest: nibabel.brikhead._unpack_var ... ok
Doctest: nibabel.brikhead.parse_AFNI_header ... ok

======================================================================
FAIL: Doctest: nibabel.brikhead.AFNIHeader.get_data_scaling
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/doctest.py", line 2224, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for nibabel.brikhead.AFNIHeader.get_data_scaling
  File "/home/yoh/proj/nipy/nipy-suite/nibabel/nibabel/brikhead.py", line 414, in get_data_scaling

----------------------------------------------------------------------
File "/home/yoh/proj/nipy/nipy-suite/nibabel/nibabel/brikhead.py", line 422, in nibabel.brikhead.AFNIHeader.get_data_scaling
Failed example:
    header.get_data_scaling()
Expected:
    array([  3.88336300e-08])
Got:
    array([3.883363e-08])


----------------------------------------------------------------------
Ran 7 tests in 0.017s

FAILED (failures=1)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions