summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_io.py
diff options
context:
space:
mode:
authorBen Walsh <b@wumpster.com>2011-07-12 16:47:12 +0100
committerMark Wiebe <mwiebe@enthought.com>2011-07-19 14:54:18 -0500
commit1dd8eb73ec89b96d17cfd46dc98aae6d97762832 (patch)
treedb7b292923bae5b9ede095c909ad8bd9d9e5d951 /numpy/lib/tests/test_io.py
parentecaf1e1765eb5697a27761b49a25081b1fffb90d (diff)
downloadnumpy-1dd8eb73ec89b96d17cfd46dc98aae6d97762832.tar.gz
BUG: datetime: Various fixes for datetime arrays.
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-rw-r--r--numpy/lib/tests/test_io.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index e83c82ecd..f9da258dc 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -776,6 +776,15 @@ M 33 21.99
dtype=[('date', np.object_), ('stid', float)])
assert_equal(test, control)
+ def test_converters_cornercases2(self):
+ "Test the conversion to datetime64."
+ converter = {'date': lambda s: np.datetime64(strptime(s, '%Y-%m-%d %H:%M:%SZ'))}
+ data = StringIO('2009-02-03 12:00:00Z, 72214.0')
+ test = np.ndfromtxt(data, delimiter=',', dtype=None,
+ names=['date', 'stid'], converters=converter)
+ control = np.array((datetime(2009, 02, 03), 72214.),
+ dtype=[('date', 'datetime64[us]'), ('stid', float)])
+ assert_equal(test, control)
def test_unused_converter(self):
"Test whether unused converters are forgotten"