From b98e5984c2c74c61b5ee452ce7553640622b46e7 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Sun, 10 Dec 2017 11:07:01 -0700 Subject: 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. --- numpy/testing/nose_tools/utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'numpy/testing/nose_tools/utils.py') 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): -- cgit v1.2.1