summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/tests/test_casting_unittests.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/numpy/core/tests/test_casting_unittests.py b/numpy/core/tests/test_casting_unittests.py
index 34f316d5d..d1924c1fd 100644
--- a/numpy/core/tests/test_casting_unittests.py
+++ b/numpy/core/tests/test_casting_unittests.py
@@ -647,8 +647,10 @@ class TestCasting:
match="casting from object to the parametric DType"):
cast._resolve_descriptors((np.dtype("O"), None))
- def test_void_to_structured_with_subarray(self):
+ @pytest.mark.parametrize("casting", ["no", "unsafe"])
+ def test_void_and_structured_with_subarray(self, casting):
# 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")
+ expected = casting == "unsafe"
+ assert np.can_cast("V4", dtype, casting=casting) == expected
+ assert np.can_cast(dtype, "V4", casting=casting) == expected