summaryrefslogtreecommitdiff
path: root/numpy/testing
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2017-12-10 11:07:01 -0700
committerCharles Harris <charlesr.harris@gmail.com>2017-12-10 13:16:06 -0700
commitb98e5984c2c74c61b5ee452ce7553640622b46e7 (patch)
treeb2bc204ac256005de9ff2e597eb024b862851f70 /numpy/testing
parent50cdfdde3eca726f56cdac5c221de96251092120 (diff)
downloadnumpy-b98e5984c2c74c61b5ee452ce7553640622b46e7.tar.gz
BUG: Fix numpy.testing.assert_equal in release mode.
To be complete, the NaT handling needs to raise AssertionError when comparing NaT's with different types. That check was previously passed on and the resulting check, which would succeed in development mode because DeprecationWarning was converted to an error, warns in release mode.
Diffstat (limited to 'numpy/testing')
-rw-r--r--numpy/testing/nose_tools/utils.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/numpy/testing/nose_tools/utils.py b/numpy/testing/nose_tools/utils.py
index 973e3bb4b..6c77e5e21 100644
--- a/numpy/testing/nose_tools/utils.py
+++ b/numpy/testing/nose_tools/utils.py
@@ -394,14 +394,17 @@ def assert_equal(actual, desired, err_msg='', verbose=True):
isdesnat = isnat(desired)
isactnat = isnat(actual)
dtypes_match = array(desired).dtype.type == array(actual).dtype.type
- if isdesnat and isactnat and dtypes_match:
+ if isdesnat and isactnat:
# If both are NaT (and have the same dtype -- datetime or
# timedelta) they are considered equal.
- return
+ if dtypes_match:
+ return
+ else:
+ raise AssertionError(msg)
+
except (TypeError, ValueError, NotImplementedError):
pass
-
try:
# Explicitly use __eq__ for comparison, gh-2552
if not (desired == actual):