summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_io.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2019-08-16 18:38:26 -0700
committerEric Wieser <wieser.eric@gmail.com>2019-08-19 17:24:58 -0500
commit731127385578fa2cf4e0ad48ef2e456d897d36de (patch)
tree82293572491a42d87f990077d6f217e52be07c67 /numpy/lib/tests/test_io.py
parent03cd242040120a149615cb2c843636069fa2ff10 (diff)
downloadnumpy-731127385578fa2cf4e0ad48ef2e456d897d36de.tar.gz
BUG: Fix crash on genfromtxt with nested empty structured array
Previously this would fail with `ValueError: could not assign tuple of length 2 to structure with 3 fields.`, now it raises `NotImplementedError`.
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-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 7ef25538b..038d08acf 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -1517,6 +1517,13 @@ M 33 21.99
test = np.genfromtxt(TextIO(data), delimiter=";",
dtype=ndtype, converters=converters)
+ # nested but empty fields also aren't supported
+ ndtype = [('idx', int), ('code', object), ('nest', [])]
+ with assert_raises_regex(NotImplementedError,
+ 'Nested fields.* not supported.*'):
+ test = np.genfromtxt(TextIO(data), delimiter=";",
+ dtype=ndtype, converters=converters)
+
def test_userconverters_with_explicit_dtype(self):
# Test user_converters w/ explicit (standard) dtype
data = TextIO('skip,skip,2001-01-01,1.0,skip')