8000 BUG: Fix numpy.testing.assert_equal in release mode. · numpy/numpy@b98e598 · GitHub
[go: up one dir, main page]

Skip to content

Commit b98e598

Browse files
committed
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.
1 parent 50cdfdd commit b98e598

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

numpy/testing/nose_tools/utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,14 +394,17 @@ def assert_equal(actual, desired, err_msg='', verbose=True):
394394
isdesnat = isnat(desired)
395395
isactnat = isnat(actual)
396396
dtypes_match = array(desired).dtype.type == array(actual).dtype.type
397-
if isdesnat and isactnat and dtypes_match:
397+
if isdesnat and isactnat:
398398
# If both are NaT (and have the same dtype -- datetime or
399399
# timedelta) they are considered equal.
400-
return
400+
if dtypes_match:
401+
return
402+
else:
403+
raise AssertionError(msg)
404+
401405
except (TypeError, ValueError, NotImplementedError):
402406
pass
403407

404-
405408
try:
406409
# Explicitly use __eq__ for comparison, gh-2552
407410
if not (desired == actual):

0 commit comments

Comments
 (0)
0