summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_io.py
diff options
context:
space:
mode:
authorStefan van der Walt <stefan@sun.ac.za>2009-05-27 23:27:19 +0000
committerStefan van der Walt <stefan@sun.ac.za>2009-05-27 23:27:19 +0000
commita2bf56aaf98ea150079ee5d05da21b18de68252a (patch)
treebbf02c6c62a98cfd74906564cb45843130258a1b /numpy/lib/tests/test_io.py
parent81a26d7fea2f4bf913426ec587ed211bf7c33fe5 (diff)
downloadnumpy-a2bf56aaf98ea150079ee5d05da21b18de68252a.tar.gz
loadtxt: allow shaped dtypes.
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-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 469c1e002..d9bf03e01 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -344,6 +344,15 @@ class TestLoadTxt(TestCase):
a = np.array([(1, (2, 3.0)), (4, (5, 6.0))], dt)
assert_array_equal(x, a)
+ def test_shaped_dtype(self):
+ c = StringIO.StringIO("aaaa 1.0 8.0 1 2 3 4 5 6")
+ dt = np.dtype([('name', 'S4'), ('x', float), ('y', float),
+ ('block', int, (2, 3))])
+ x = np.loadtxt(c, dtype=dt)
+ a = np.array([('aaaa', 1.0, 8.0, [[1, 2, 3], [4, 5, 6]])],
+ dtype=dt)
+ assert_array_equal(x, a)
+
def test_empty_file(self):
c = StringIO.StringIO()
assert_raises(IOError, np.loadtxt, c)