diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2008-09-09 13:38:34 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2008-09-09 13:38:34 +0000 |
commit | 27d5aff700a2841cc0a30a4f774dcc67363fa287 (patch) | |
tree | acd5e41bb946b90b8e4de50b219cdb806ee97277 /numpy/lib/tests/test_io.py | |
parent | b01bf6ffea880fc28daaa6877e2d4653aeab3d7f (diff) | |
download | numpy-27d5aff700a2841cc0a30a4f774dcc67363fa287.tar.gz |
FIX: Loadtxt raises on empty input (closes #908).
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-rw-r--r-- | numpy/lib/tests/test_io.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py index 4e6412e09..9cccbe041 100644 --- a/numpy/lib/tests/test_io.py +++ b/numpy/lib/tests/test_io.py @@ -140,7 +140,6 @@ class TestLoadTxt(TestCase): y = np.loadtxt(d, dtype=mydescriptor) assert_array_equal(y, b) - def test_array(self): c = StringIO.StringIO() c.write('1 2\n3 4') @@ -188,7 +187,7 @@ class TestLoadTxt(TestCase): usecols=(1, 3, )) a = np.array([[2, -999],[7, 9]], int) assert_array_equal(x, a) - + def test_comments(self): c = StringIO.StringIO() c.write('# comment\n1,2,3,5\n') @@ -230,7 +229,7 @@ class TestLoadTxt(TestCase): x = np.loadtxt(c, dtype=float, usecols=(1,2)) assert_array_equal(x, a[:,1:]) - # Testing with arrays instead of tuples. + # Testing with arrays instead of tuples. c.seek(0) x = np.loadtxt(c, dtype=float, usecols=np.array([1,2])) assert_array_equal(x, a[:,1:]) @@ -255,6 +254,9 @@ class TestLoadTxt(TestCase): a = np.array([(1,(2,3.0)),(4,(5,6.0))], dt) assert_array_equal(x, a) + def test_empty_file(self): + c = StringIO.StringIO() + assert_raises(IOError, np.loadtxt, c) class Testfromregex(TestCase): def test_record(self): |