summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorStephan Hoyer <shoyer@google.com>2018-05-23 23:23:56 -0700
committerStephan Hoyer <shoyer@google.com>2018-05-23 23:27:59 -0700
commit2666831389e4834ea83741a4ba104f62fdb47704 (patch)
tree92517472e0198f40b535d9f1f2173560710ca39c /numpy
parent4d02fb11352a45b05e5d50db6e71153b2aec7527 (diff)
downloadnumpy-2666831389e4834ea83741a4ba104f62fdb47704.tar.gz
TST: regression test for gh-6452
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_datetime.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/numpy/core/tests/test_datetime.py b/numpy/core/tests/test_datetime.py
index dca2d2541..c85b77613 100644
--- a/numpy/core/tests/test_datetime.py
+++ b/numpy/core/tests/test_datetime.py
@@ -124,7 +124,7 @@ class TestDateTime(object):
assert_(not np.can_cast('M8[h]', 'M8', casting='safe'))
def test_compare_generic_nat(self):
- # regression tests for GH6452
+ # regression tests for gh-6452
assert_equal(np.datetime64('NaT'),
np.datetime64('2000') + np.timedelta64('NaT'))
# nb. we may want to make NaT != NaT true in the future
@@ -325,6 +325,15 @@ class TestDateTime(object):
assert_raises(TypeError, np.timedelta64, a, 'D')
assert_raises(TypeError, np.timedelta64, a, 'm')
+ def test_timedelta_object_array_conversion(self):
+ # Regression test for GH11096
+ inputs = [datetime.timedelta(28),
+ datetime.timedelta(30),
+ datetime.timedelta(31)]
+ expected = np.array([28, 30, 31], dtype='timedelta64[D]')
+ actual = np.array(inputs, dtype='timedelta64[D]')
+ assert_equal(expected, actual)
+
def test_timedelta_scalar_construction_units(self):
# String construction detecting units
assert_equal(np.datetime64('2010').dtype,