diff options
-rw-r--r-- | numpy/core/tests/test_regression.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py index f8f75d9ea..ba4413138 100644 --- a/numpy/core/tests/test_regression.py +++ b/numpy/core/tests/test_regression.py @@ -2375,3 +2375,19 @@ class TestRegression(object): structure = np.array([1], dtype=[(('x', 'X'), np.object_)]) structure[0]['x'] = np.array([2]) gc.collect() + + def test_dtype_scalar_squeeze(self): + # gh-11384 + values = { + 'S': b"a", + 'M': "2018-06-20", + } + for ch in np.typecodes['All']: + if ch in 'O': + continue + sctype = np.dtype(ch).type + scvalue = sctype(values.get(ch, 3)) + for axis in [None, ()]: + squeezed = scvalue.squeeze(axis=axis) + assert_equal(squeezed, scvalue) + assert_equal(type(squeezed), type(scvalue)) |