diff options
author | Derek Homeier <derek@astro.physik.uni-goettingen.de> | 2011-05-05 01:01:08 +0200 |
---|---|---|
committer | Ralf Gommers <ralf.gommers@googlemail.com> | 2011-05-07 22:12:28 +0200 |
commit | 607d2b3bbe984892fbf345788a54eafebdf967ed (patch) | |
tree | 53db9b466618682614d20956157202c1ac540454 /numpy/lib/tests | |
parent | 6df2ac2173331ed91e79e69bb5caea07c12f410d (diff) | |
download | numpy-607d2b3bbe984892fbf345788a54eafebdf967ed.tar.gz |
changed ndmin option in loadtxt to return shape (1, X.size) for single-row inputs
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r-- | numpy/lib/tests/test_io.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py index aa27e7ecc..97633d525 100644 --- a/numpy/lib/tests/test_io.py +++ b/numpy/lib/tests/test_io.py @@ -486,11 +486,17 @@ class TestLoadTxt(TestCase): d.write(asbytes('0,1,2')) d.seek(0) x = np.loadtxt(d, dtype=int, delimiter=',', ndmin=2) - assert_(x.shape == (3, 1)) + assert_(x.shape == (1, 3)) assert_raises(ValueError, np.loadtxt, d, ndmin=3) assert_raises(ValueError, np.loadtxt, d, ndmin=1.5) e = StringIO() - assert_(np.loadtxt(e, ndmin=2).shape == (0, 1,)) + e.write(asbytes('0\n1\n2')) + e.seek(0) + x = np.loadtxt(e, dtype=int, delimiter=',', ndmin=2) + assert_(x.shape == (3, 1)) + f = StringIO() + assert_(np.loadtxt(f, ndmin=2).shape == (0, 1,)) + assert_(np.loadtxt(f, ndmin=1).shape == (0,)) def test_generator_source(self): def count(): |