diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-04-22 14:54:54 +0100 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-10-01 16:46:19 -0700 |
commit | 0e9e205c3b1d90dc6782bd21bb428d17aded0e90 (patch) | |
tree | 04fa3c3bbb088ee014364160a214370222567c0d /numpy/core/tests/test_multiarray.py | |
parent | eb514b1c87d8d2c0e2ae159cf24046d490b2c448 (diff) | |
download | python-numpy-0e9e205c3b1d90dc6782bd21bb428d17aded0e90.tar.gz python-numpy-0e9e205c3b1d90dc6782bd21bb428d17aded0e90.tar.bz2 python-numpy-0e9e205c3b1d90dc6782bd21bb428d17aded0e90.zip |
BUG: Prevent ValueError when resizing V0 arrays
Diffstat (limited to 'numpy/core/tests/test_multiarray.py')
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 9703fdbb5..8ab2c97f5 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -1207,6 +1207,10 @@ class TestBool(object): class TestZeroSizeFlexible(object): @staticmethod def _zeros(shape, dtype=str): + dtype = np.dtype(dtype) + if dtype == np.void: + return np.zeros(shape, dtype=(dtype, 0)) + # not constructable directly dtype = np.dtype([('x', dtype, 0)]) return np.zeros(shape, dtype=dtype)['x'] @@ -1241,6 +1245,13 @@ class TestZeroSizeFlexible(object): def test_argpartition(self): self._test_sort_partition('argpartition', kinds=['introselect'], kth=2) + def test_resize(self): + # previously an error + for dt in [bytes, np.void, unicode]: + zs = self._zeros(10, dt) + zs.resize(25) + zs.resize((10, 10)) + class TestMethods(object): def test_compress(self): |