diff --git a/array_api_tests/dtype_helpers.py b/array_api_tests/dtype_helpers.py index 4729d8f9..d7346aa1 100644 --- a/array_api_tests/dtype_helpers.py +++ b/array_api_tests/dtype_helpers.py @@ -164,6 +164,11 @@ def _make_dtype_tuple_from_names(names: List[str]) -> Tuple[DataType]: } +def available_kinds(): + return { + kind for kind, dtypes in kind_to_dtypes.items() if dtypes + } + def is_int_dtype(dtype): return dtype in all_int_dtypes diff --git a/array_api_tests/test_inspection_functions.py b/array_api_tests/test_inspection_functions.py index eaac0276..cff25f99 100644 --- a/array_api_tests/test_inspection_functions.py +++ b/array_api_tests/test_inspection_functions.py @@ -1,5 +1,6 @@ import pytest from hypothesis import given, strategies as st +from array_api_tests.dtype_helpers import available_kinds from . import xp @@ -16,7 +17,8 @@ def test_array_namespace_info(): default_dtypes = out.default_dtypes() assert isinstance(default_dtypes, dict) - assert {"real floating", "complex floating", "integral", "indexing"}.issubset(set(default_dtypes.keys())) + expected_subset = {"real floating", "complex floating", "integral"} & available_kinds() | {"indexing"} + assert expected_subset.issubset(set(default_dtypes.keys())) devices = out.devices() assert isinstance(devices, list)