summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorRaunak Shah <32986603+raunaks13@users.noreply.github.com>2018-04-17 05:12:01 +0000
committerEric Wieser <wieser.eric@gmail.com>2018-04-16 22:12:01 -0700
commit8323be1bc44c2811fc36f5b99c1a30ebcee8edbd (patch)
treece7a026aa95f62b2fc557d6573367b8022d9bb42 /numpy/lib/tests
parent3b79c4405690227087022a943fd78217b700a3f5 (diff)
downloadnumpy-8323be1bc44c2811fc36f5b99c1a30ebcee8edbd.tar.gz
BUG: fix crash in numpy.genfromtxt(..., names=True, comments=None) (#10822)
Fixes gh-10780
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_io.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index 7dcefe80d..84aca9915 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -1317,6 +1317,13 @@ M 33 21.99
assert_(w[0].category is np.VisibleDeprecationWarning)
assert_equal(test, ctrl)
+ def test_names_and_comments_none(self):
+ # Tests case when names is true but comments is None (gh-10780)
+ data = TextIO('col1 col2\n 1 2\n 3 4')
+ test = np.genfromtxt(data, dtype=(int, int), comments=None, names=True)
+ control = np.array([(1, 2), (3, 4)], dtype=[('col1', int), ('col2', int)])
+ assert_equal(test, control)
+
def test_autonames_and_usecols(self):
# Tests names and usecols
data = TextIO('A B C D\n aaaa 121 45 9.1')