-
Notifications
You must be signed in to change notification settings - Fork 261
TEST: Use package-wide setup and teardown to adjust numpy print options #785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
nibabel/__init__.py
Outdated
if LooseVersion(numpy.__version__) >= LooseVersion('1.14'): | ||
numpy.set_printoptions(legacy="1.13") | ||
if nb._save_printopts is None: | ||
nb._save_printopts = np.get_printoptions().get('legacy') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so it is not "printopts" really but a "legacyprintopt", right?
FWIW -- ATM it is just a single variable here. In DataLad we setup/teardown a few, so I just made a _test_states
dict variable: https://github.com/datalad/datalad/blob/master/datalad/__init__.py#L92 to store all those in without breeding them at the top module level.
FWIW doctest is passing for me locally with this change$> 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 ... ok
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
----------------------------------------------------------------------
Ran 7 tests in 0.015s
OK |
Nice. I went ahead and copied that approach. I think it looks cleaner overall, |
Any further comments? |
Co-Authored-By: Yaroslav Halchenko <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #785 +/- ##
==========================================
- Coverage 89.99% 89.98% -0.01%
==========================================
Files 94 94
Lines 12009 12012 +3
Branches 2133 2135 +2
==========================================
+ Hits 10807 10809 +2
Misses 859 859
- Partials 343 344 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #785 +/- ##
==========================================
- Coverage 89.99% 89.98% -0.01%
==========================================
Files 94 94
Lines 12009 12011 +2
Branches 2133 2135 +2
==========================================
+ Hits 10807 10808 +1
Misses 859 859
- Partials 343 344 +1
Continue to review full report at Codecov.
|
Thanks for the review. |
Fixes #784.