diff options
author | pierregm <pierregm@localhost> | 2009-02-03 17:11:44 +0000 |
---|---|---|
committer | pierregm <pierregm@localhost> | 2009-02-03 17:11:44 +0000 |
commit | 8ab9363953bd9e77bf1bf84c931b426422b90558 (patch) | |
tree | cbd42f59969b389d0b254e7f9d0e95e553a3641f /numpy/lib/tests/test_io.py | |
parent | f278427bb52fdfdc524d1da4032777ca5290e49e (diff) | |
download | numpy-8ab9363953bd9e77bf1bf84c931b426422b90558.tar.gz |
* Make sure that StringConverter.update sets the type to object if it can't define it.
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-rw-r--r-- | numpy/lib/tests/test_io.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py index 2995d6709..da91d8a8d 100644 --- a/numpy/lib/tests/test_io.py +++ b/numpy/lib/tests/test_io.py @@ -535,6 +535,17 @@ M 33 21.99 dtype=[('A', '|S4'), ('C', int), ('D', float)]) assert_equal(test, control) + def test_converters_cornercases(self): + "Test the conversion to datetime." + from datetime import datetime + converter = {'date':lambda s: datetime.strptime(s,'%Y-%m-%d %H:%M:%SZ')} + data = StringIO.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,12,0), 72214.), + dtype=[('date', np.object_), ('stid', float)]) + assert_equal(test, control) + def test_unused_converter(self): "Test whether unused converters are forgotten" |