summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorMark Wiebe <mwiebe@enthought.com>2011-07-19 14:55:30 -0500
committerMark Wiebe <mwiebe@enthought.com>2011-07-19 14:55:35 -0500
commitd6c3b44b6645a02754c0acff70b35131a01353dd (patch)
treee77a0f5bc62a3ec7105782baac6f1560c21aadb7 /numpy/lib/tests
parentecaf1e1765eb5697a27761b49a25081b1fffb90d (diff)
parent91646576e73d6cf9eb6ff4914292844ea40605f1 (diff)
downloadnumpy-d6c3b44b6645a02754c0acff70b35131a01353dd.tar.gz
MRG: Merge branch 'walshb/datetime_array_fixes'
Diffstat (limited to 'numpy/lib/tests')
-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"