summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_format.py
diff options
context:
space:
mode:
authorSha Liu <liushapku@users.noreply.github.com>2020-01-28 11:30:20 +0800
committerSebastian Berg <sebastian@sipsolutions.net>2020-01-27 19:30:20 -0800
commit79eff02e7e2c3b1865ee47fa66ae40f44894cadb (patch)
tree7a468d5644056d059b9a431983d6ee81e32fd057 /numpy/lib/tests/test_format.py
parentf398a0df8a2105b2fdeaeab54505451169b0a869 (diff)
downloadnumpy-79eff02e7e2c3b1865ee47fa66ae40f44894cadb.tar.gz
BUG: np.load does not handle empty array with an empty descr (#15397)
The bug occurs since numpy 1.16. Before that empty descr corresponds to `np.dtype([])`. This fixes the problem by following numpy 1.15's behavior. Closes gh-15396
Diffstat (limited to 'numpy/lib/tests/test_format.py')
-rw-r--r--numpy/lib/tests/test_format.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py
index 24593d7b3..2dbaeb8cb 100644
--- a/numpy/lib/tests/test_format.py
+++ b/numpy/lib/tests/test_format.py
@@ -535,8 +535,10 @@ dt4 = np.dtype({'names': ['a', '', 'b'], 'formats': ['i4']*3})
# titles
dt5 = np.dtype({'names': ['a', 'b'], 'formats': ['i4', 'i4'],
'offsets': [1, 6], 'titles': ['aa', 'bb']})
+# empty
+dt6 = np.dtype({'names': [], 'formats': [], 'itemsize': 8})
-@pytest.mark.parametrize("dt", [dt1, dt2, dt3, dt4, dt5])
+@pytest.mark.parametrize("dt", [dt1, dt2, dt3, dt4, dt5, dt6])
def test_load_padded_dtype(dt):
arr = np.zeros(3, dt)
for i in range(3):