diff options
author | Mark Wiebe <mwiebe@enthought.com> | 2011-07-19 14:55:30 -0500 |
---|---|---|
committer | Mark Wiebe <mwiebe@enthought.com> | 2011-07-19 14:55:35 -0500 |
commit | d6c3b44b6645a02754c0acff70b35131a01353dd (patch) | |
tree | e77a0f5bc62a3ec7105782baac6f1560c21aadb7 /numpy/lib/tests | |
parent | ecaf1e1765eb5697a27761b49a25081b1fffb90d (diff) | |
parent | 91646576e73d6cf9eb6ff4914292844ea40605f1 (diff) | |
download | numpy-d6c3b44b6645a02754c0acff70b35131a01353dd.tar.gz |
MRG: Merge branch 'walshb/datetime_array_fixes'
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r-- | numpy/lib/tests/test_io.py | 9 |
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" |