diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2016-06-19 13:39:46 +0200 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2016-09-02 10:10:55 +0200 |
commit | 86b0a5e9c58160bad818ba3a0a6faf38f5ac4d09 (patch) | |
tree | 928ce2677bcdf6735ebac42955859f5d522200b1 /numpy/ma/testutils.py | |
parent | 968507bdfb4467d5ec6e3b6999a5717100782c3c (diff) | |
download | numpy-86b0a5e9c58160bad818ba3a0a6faf38f5ac4d09.tar.gz |
BUG: Suppress common NaT warnings
Printing of datetime arrays used to cause warning due to
comparison warnings in NaT. This is circumvented by using views
to integer values. Part of this should be simplified when
the deprecation is over.
Also fixes a bug with non-native byteorder.
Diffstat (limited to 'numpy/ma/testutils.py')
-rw-r--r-- | numpy/ma/testutils.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/numpy/ma/testutils.py b/numpy/ma/testutils.py index 8dc821878..866316c62 100644 --- a/numpy/ma/testutils.py +++ b/numpy/ma/testutils.py @@ -14,7 +14,7 @@ from numpy import ndarray, float_ import numpy.core.umath as umath from numpy.testing import ( TestCase, assert_, assert_allclose, assert_array_almost_equal_nulp, - assert_raises, build_err_msg, run_module_suite, + assert_raises, build_err_msg, run_module_suite, suppress_warnings ) import numpy.testing.utils as utils from .core import mask_or, getmask, masked_array, nomask, masked, filled @@ -126,8 +126,10 @@ def assert_equal(actual, desired, err_msg=''): return _assert_equal_on_sequences(actual, desired, err_msg='') if not (isinstance(actual, ndarray) or isinstance(desired, ndarray)): msg = build_err_msg([actual, desired], err_msg,) - if not desired == actual: - raise AssertionError(msg) + with suppress_warnings() as sup: + sup.filter(FutureWarning, ".*NAT ==") + if not desired == actual: + raise AssertionError(msg) return # Case #4. arrays or equivalent if ((actual is masked) and not (desired is masked)) or \ |