diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2008-09-22 20:28:00 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2008-09-22 20:28:00 +0000 |
commit | f1855ef6c44ff037b606cbc0673a536ece31a945 (patch) | |
tree | d056013285f0c17abc2489b0c95861c6fcf3bdf6 /numpy/lib/tests/test_io.py | |
parent | 3060e39a4dc5ffc4852d7f7b2adc8f8d79bde0df (diff) | |
download | numpy-f1855ef6c44ff037b606cbc0673a536ece31a945.tar.gz |
Ignore unused converters in `loadtxt`.
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 9cccbe041..d257b5423 100644 --- a/numpy/lib/tests/test_io.py +++ b/numpy/lib/tests/test_io.py @@ -258,6 +258,17 @@ class TestLoadTxt(TestCase): c = StringIO.StringIO() assert_raises(IOError, np.loadtxt, c) + def test_unused_converter(self): + c = StringIO.StringIO() + c.writelines(['1 21\n', '3 42\n']) + c.seek(0) + data = np.loadtxt(c, usecols=(1,), converters={0: lambda s: int(s, 16)}) + assert_array_equal(data, [21, 42]) + + c.seek(0) + data = np.loadtxt(c, usecols=(1,), converters={1: lambda s: int(s, 16)}) + assert_array_equal(data, [33, 66]) + class Testfromregex(TestCase): def test_record(self): c = StringIO.StringIO() |