summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorBen Walsh <b@wumpster.com>2011-07-12 14:52:01 +0100
committerMark Wiebe <mwwiebe@gmail.com>2011-07-12 09:20:36 -0500
commit6fdfd9c070ce943415d75780702a22f4bbd8f837 (patch)
tree7dd8a663d75bd5e2ccebc8579bd5e5179e3ce7a8 /numpy
parentfeb8079070b8a659d7eee1b4acbddf470fd8a81d (diff)
downloadnumpy-6fdfd9c070ce943415d75780702a22f4bbd8f837.tar.gz
TST: Added more tests for datetime array construction.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_datetime.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/numpy/core/tests/test_datetime.py b/numpy/core/tests/test_datetime.py
index ea03ab9b3..2770364f0 100644
--- a/numpy/core/tests/test_datetime.py
+++ b/numpy/core/tests/test_datetime.py
@@ -174,6 +174,31 @@ class TestDateTime(TestCase):
arr = np.array([dt])
assert_equal(arr.dtype, np.dtype('M8[M]'))
+ # at the moment, we don't automatically convert these to datetime64
+
+ dt = datetime.date(1970, 1, 1)
+ arr = np.array([dt])
+ assert_equal(arr.dtype, np.dtype('O'))
+
+ dt = datetime.datetime(1970, 1, 1, 12, 30, 40)
+ arr = np.array([dt])
+ assert_equal(arr.dtype, np.dtype('O'))
+
+ # find "supertype" for non-dates and dates
+
+ b = np.bool_(True)
+ dt = np.datetime64('1970-01-01', 'M')
+ arr = np.array([b, dt])
+ assert_equal(arr.dtype, np.dtype('O'))
+
+ dt = datetime.date(1970, 1, 1)
+ arr = np.array([b, dt])
+ assert_equal(arr.dtype, np.dtype('O'))
+
+ dt = datetime.datetime(1970, 1, 1, 12, 30, 40)
+ arr = np.array([b, dt])
+ assert_equal(arr.dtype, np.dtype('O'))
+
def test_timedelta_scalar_construction(self):
# Construct with different units
assert_equal(np.timedelta64(7, 'D'),