From 3539267d162aaa280abebc8bd4f5c542ad50f6de Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Wed, 30 Nov 2022 14:30:19 -0700 Subject: [PATCH] Don't require can_cast to return False for cross-kind casting Fixes #151. --- array_api_tests/test_data_type_functions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/array_api_tests/test_data_type_functions.py b/array_api_tests/test_data_type_functions.py index 763c71a4..115ec9b9 100644 --- a/array_api_tests/test_data_type_functions.py +++ b/array_api_tests/test_data_type_functions.py @@ -124,7 +124,11 @@ def test_can_cast(_from, to, data): expected = from_min >= to_min and from_max <= to_max else: expected = False - assert out == expected, f"{out=}, but should be {expected} {f_func}" + if expected: + # cross-kind casting is not explicitly disallowed. We can only test + # the cases where it should return True. TODO: if expected=False, + # check that the array library actually allows such casts. + assert out == expected, f"{out=}, but should be {expected} {f_func}" def make_dtype_id(dtype: DataType) -> str: