summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_io.py
diff options
context:
space:
mode:
authordhuard <dhuard@localhost>2008-04-04 20:13:24 +0000
committerdhuard <dhuard@localhost>2008-04-04 20:13:24 +0000
commitf2e6d8e233d380133d8e3504272b3ed0554bfaa4 (patch)
treea072490fe4fd2d36d27ade3fbe41ebaa40cd9fa2 /numpy/lib/tests/test_io.py
parent343841340122a5c5bd2071584e81ad8e027e6389 (diff)
downloadnumpy-f2e6d8e233d380133d8e3504272b3ed0554bfaa4.tar.gz
Modified io._getconv to allow loading values stored as float as integers arrays. Added test to check the behavior as suggested in the comment from b. southey in
ticket #623
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-rw-r--r--numpy/lib/tests/test_io.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index 35203a38d..c219f6fcd 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -41,6 +41,16 @@ class Testloadtxt(NumpyTestCase):
a = np.array([(1, 2), (3, 4)], dtype=[('x', '<i4'), ('y', '<i4')])
assert_array_equal(x, a)
+ d = StringIO.StringIO()
+ d.write('M 64.0 75.0\nF 25.0 60.0')
+ d.seek(0)
+
+ mydescriptor = {'names': ('gender','age','weight'), 'formats': ('S1',
+ 'i4', 'f4')}
+ b = np.array([('M', 64.0, 75.0),('F', 25.0, 60.0)], dtype=mydescriptor)
+ y = np.loadtxt(d, dtype=mydescriptor)
+ assert_array_equal(y, b)
+
def test_array(self):
c = StringIO.StringIO()
c.write('1 2\n3 4')