summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2020-08-19 10:02:33 -0600
committerCharles Harris <charlesr.harris@gmail.com>2020-08-19 12:48:47 -0600
commit434d2f141d7e473040effdba37e29ffd3b75a25c (patch)
tree586d83ee1bd560d8835982811ed7541952b58b4b /numpy/core
parent8c226bf9b19a3b974bc63421918d068660ba506c (diff)
downloadnumpy-434d2f141d7e473040effdba37e29ffd3b75a25c.tar.gz
TST: Add tests for bugs fixed in gh-17068.
- Invalid conversion error bug. - ``__array_interface__['descr']`` bug
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/tests/test_regression.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py
index 51cf7039f..f778d4d7c 100644
--- a/numpy/core/tests/test_regression.py
+++ b/numpy/core/tests/test_regression.py
@@ -2488,3 +2488,16 @@ class TestRegression:
assert arr.size * arr.itemsize > 2 ** 31
c_arr = np.ctypeslib.as_ctypes(arr)
assert_equal(c_arr._length_, arr.size)
+
+ def test_complex_conversion_error(self):
+ # gh-17068
+ with pytest.raises(TypeError, match=r"Unable to convert dtype.*"):
+ complex(np.array("now", np.datetime64))
+
+ def test__array_interface__descr(self):
+ # gh-17068
+ dt = np.dtype(dict(names=['a', 'b'],
+ offsets=[0, 0],
+ formats=[np.int64, np.int64]))
+ descr = np.array((1, 1), dtype=dt).__array_interface__['descr']
+ assert descr == [('', '|V8')] # instead of [(b'', '|V8')]