summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Lee <grlee77@gmail.com>2021-06-24 11:44:37 -0400
committerGregory Lee <grlee77@gmail.com>2021-06-24 11:44:37 -0400
commit8925fec4721b3a89e94d59b6149884d07fc581f4 (patch)
tree8c4d072e0c9e0ad599283a68d121df1e973d5593
parent3c901b49bd8715c93824c27682d81434d869498a (diff)
downloadnumpy-8925fec4721b3a89e94d59b6149884d07fc581f4.tar.gz
TST: test can_cast when only one argument has a subarray
-rw-r--r--numpy/core/tests/test_casting_unittests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/core/tests/test_casting_unittests.py b/numpy/core/tests/test_casting_unittests.py
index 2cec1acd3..34f316d5d 100644
--- a/numpy/core/tests/test_casting_unittests.py
+++ b/numpy/core/tests/test_casting_unittests.py
@@ -646,3 +646,9 @@ class TestCasting:
with pytest.raises(TypeError,
match="casting from object to the parametric DType"):
cast._resolve_descriptors((np.dtype("O"), None))
+
+ def test_void_to_structured_with_subarray(self):
+ # test case corresponding to gh-19325
+ dtype = np.dtype([("foo", "<f4", (3, 2))])
+ assert np.can_cast("V4", dtype, casting="unsafe")
+ assert not np.can_cast("V4", dtype, casting="no")