summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_io.py
diff options
context:
space:
mode:
authordhuard <dhuard@localhost>2008-04-03 14:17:08 +0000
committerdhuard <dhuard@localhost>2008-04-03 14:17:08 +0000
commit1b8a670793e06d3450bacc499fad5f074a95c8e7 (patch)
treeb9b8b1047475fec1956c6e8353728f0ca1500b9f /numpy/lib/tests/test_io.py
parent8784a1abd5c74dbd134a04a4bcd0f050fe650ed6 (diff)
downloadnumpy-1b8a670793e06d3450bacc499fad5f074a95c8e7.tar.gz
added 1D tests for loadtxt and savetxt. Fixed a bug
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-rw-r--r--numpy/lib/tests/test_io.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index 19dbc8fd6..35203a38d 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -16,6 +16,13 @@ class Testsavetxt(NumpyTestCase):
c.seek(0)
assert(c.readlines(), ['1 2\n', '3 4\n'])
+ def test_1D(self):
+ a = np.array([1,2,3,4], int)
+ c = StringIO.StringIO()
+ np.savetxt(c, a, fmt='%d')
+ c.seek(0)
+ assert(c.readlines(), ['1\n', '2\n', '3\n', '4\n'])
+
def test_record(self):
a = np.array([(1, 2), (3, 4)], dtype=[('x', '<i4'), ('y', '<i4')])
c = StringIO.StringIO()
@@ -48,5 +55,13 @@ class Testloadtxt(NumpyTestCase):
a = np.array([[1,2],[3,4]], float)
assert_array_equal(x, a)
+ def test_1D(self):
+ c = StringIO.StringIO()
+ c.write('1\n2\n3\n4\n')
+ c.seek(0)
+ x = np.loadtxt(c, dtype=int)
+ a = np.array([1,2,3,4], int)
+ assert_array_equal(x, a)
+
if __name__ == "__main__":
NumpyTest().run()