summaryrefslogtreecommitdiff
path: root/numpy/testing/tests
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-11-26 23:04:50 -0800
committerEric Wieser <wieser.eric@gmail.com>2017-11-26 23:04:50 -0800
commitf107d38b0513290307fa83dccebfe7db897d87b4 (patch)
tree81f844fd401e9f5a54b970d5bd81ac8afddb5904 /numpy/testing/tests
parent8cdf0cf7dca58c7b4899860f5ab35dbe3a9e0833 (diff)
downloadnumpy-f107d38b0513290307fa83dccebfe7db897d87b4.tar.gz
BUG: Fix assert_equal on time-like objects
Also does some cleanup on the float assert_equal to make it look more similar. Fixes #10081
Diffstat (limited to 'numpy/testing/tests')
-rw-r--r--numpy/testing/tests/test_utils.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py
index c440d8eca..8f259cf4a 100644
--- a/numpy/testing/tests/test_utils.py
+++ b/numpy/testing/tests/test_utils.py
@@ -212,6 +212,26 @@ class TestEqual(TestArrayEqual):
self._assert_func([np.inf], [np.inf])
self._test_not_equal(np.inf, [np.inf])
+ def test_datetime(self):
+ self._test_equal(
+ np.datetime64("2017-01-01", "s"),
+ np.datetime64("2017-01-01", "s")
+ )
+ self._test_equal(
+ np.datetime64("2017-01-01", "s"),
+ np.datetime64("2017-01-01", "m")
+ )
+
+ # gh-10081
+ self._test_not_equal(
+ np.datetime64("2017-01-01", "s"),
+ np.datetime64("2017-01-02", "s")
+ )
+ self._test_not_equal(
+ np.datetime64("2017-01-01", "s"),
+ np.datetime64("2017-01-02", "m")
+ )
+
def test_nat_items(self):
# not a datetime
nadt_no_unit = np.datetime64("NaT")