summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2017-05-07 16:06:20 +0200
committerSebastian Berg <sebastian@sipsolutions.net>2017-05-07 16:21:30 +0200
commitca05d523c3d022eba8ea1bf75b50c60550d30d5a (patch)
treea2fa7455f16f5a4262a86bbdc8bb652b8160963b
parent92aa4080f2a925ff6d03d0b9f80460a53d4c111c (diff)
downloadnumpy-ca05d523c3d022eba8ea1bf75b50c60550d30d5a.tar.gz
BUG: Remove warning NaT filter from masked array test utils
This may show warnings in downstream projects, which should likely not be there. We could also drop in the normal assert_equal there, which would support NaT, and NaN, but checks for scalarness, which this currently does not (which also could create problems). Works around the only test with this problem, by using the normal assert_equal there.
-rw-r--r--numpy/ma/tests/test_core.py4
-rw-r--r--numpy/ma/testutils.py8
2 files changed, 5 insertions, 7 deletions
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
index f807fc8ae..b8cb8f1a4 100644
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -1841,11 +1841,11 @@ class TestFillingValues(TestCase):
"h", "D", "W", "M", "Y"):
control = numpy.datetime64("NaT", timecode)
test = default_fill_value(numpy.dtype("<M8[" + timecode + "]"))
- assert_equal(test, control)
+ np.testing.utils.assert_equal(test, control)
control = numpy.timedelta64("NaT", timecode)
test = default_fill_value(numpy.dtype("<m8[" + timecode + "]"))
- assert_equal(test, control)
+ np.testing.utils.assert_equal(test, control)
def test_extremum_fill_value(self):
# Tests extremum fill values for flexible type.
diff --git a/numpy/ma/testutils.py b/numpy/ma/testutils.py
index 866316c62..c19066d71 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, suppress_warnings
+ assert_raises, build_err_msg, run_module_suite
)
import numpy.testing.utils as utils
from .core import mask_or, getmask, masked_array, nomask, masked, filled
@@ -126,10 +126,8 @@ 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,)
- with suppress_warnings() as sup:
- sup.filter(FutureWarning, ".*NAT ==")
- if not desired == actual:
- raise AssertionError(msg)
+ if not desired == actual:
+ raise AssertionError(msg)
return
# Case #4. arrays or equivalent
if ((actual is masked) and not (desired is masked)) or \