summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Lee <grlee77@gmail.com>2021-06-24 13:41:03 -0400
committerGregory Lee <grlee77@gmail.com>2021-06-24 13:41:03 -0400
commit9bf60f5f8c5d0dde78b737932e61dec61b960d53 (patch)
tree831e3f243cd10bb9d1fe6cc93716f47c8705610b
parent8925fec4721b3a89e94d59b6149884d07fc581f4 (diff)
downloadnumpy-9bf60f5f8c5d0dde78b737932e61dec61b960d53.tar.gz
TST: test both argument orders
-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