diff options
author | Mark Wiebe <mwwiebe@gmail.com> | 2011-01-16 23:02:06 -0800 |
---|---|---|
committer | Mark Wiebe <mwwiebe@gmail.com> | 2011-01-16 23:02:06 -0800 |
commit | e6c3a0c9411fa0fb701261a206a2a4d002de68cd (patch) | |
tree | c948986c19549cebf7f180d98e1be9a83aa2df34 /numpy/lib/tests/test_io.py | |
parent | 03dd59a0fa368d30a05b5a3d7da8d41b253e087a (diff) | |
download | numpy-e6c3a0c9411fa0fb701261a206a2a4d002de68cd.tar.gz |
ENH: core: Implement PyArray_CopyInto using the new iterator
This change also uses the dtype conversion code implemented for new
iterator buffering, which differs slightly from the previous casting
behavior. In particular, fields are matched up by name instead of
position, so code depending on that behavior breaks. The loadtxt
function has been fixed to not depend on this casting behavior.
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-rw-r--r-- | numpy/lib/tests/test_io.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py index a85b01909..04497dee8 100644 --- a/numpy/lib/tests/test_io.py +++ b/numpy/lib/tests/test_io.py @@ -381,6 +381,15 @@ class TestLoadTxt(TestCase): dtype=dt) assert_array_equal(x, a) + def test_3d_shaped_dtype(self): + c = StringIO("aaaa 1.0 8.0 1 2 3 4 5 6 7 8 9 10 11 12") + dt = np.dtype([('name', 'S4'), ('x', float), ('y', float), + ('block', int, (2, 2, 3))]) + x = np.loadtxt(c, dtype=dt) + a = np.array([('aaaa', 1.0, 8.0, [[[1, 2, 3], [4, 5, 6]],[[7, 8, 9], [10, 11, 12]]])], + dtype=dt) + assert_array_equal(x, a) + def test_empty_file(self): c = StringIO() assert_raises(IOError, np.loadtxt, c) @@ -884,7 +893,6 @@ M 33 21.99 dtype=dt) assert_array_equal(x, a) - def test_withmissing(self): data = StringIO('A,B\n0,1\n2,N/A') kwargs = dict(delimiter=",", missing_values="N/A", names=True) |