Skip to content

Commit dad7731

Browse files
authored
Merge pull request #337 from adityagoel4512/skip-unused-kinds-in-default
Do not require default dtype if no dtypes in kind supported
2 parents d982a62 + 80c2978 commit dad7731

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Diff for: array_api_tests/dtype_helpers.py

+5
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ def _make_dtype_tuple_from_names(names: List[str]) -> Tuple[DataType]:
164164
}
165165

166166

167+
def available_kinds():
168+
return {
169+
kind for kind, dtypes in kind_to_dtypes.items() if dtypes
170+
}
171+
167172
def is_int_dtype(dtype):
168173
return dtype in all_int_dtypes
169174

Diff for: array_api_tests/test_inspection_functions.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
from hypothesis import given, strategies as st
3+
from array_api_tests.dtype_helpers import available_kinds
34

45
from . import xp
56

@@ -16,7 +17,8 @@ def test_array_namespace_info():
1617

1718
default_dtypes = out.default_dtypes()
1819
assert isinstance(default_dtypes, dict)
19-
assert {"real floating", "complex floating", "integral", "indexing"}.issubset(set(default_dtypes.keys()))
20+
expected_subset = {"real floating", "complex floating", "integral"} & available_kinds() | {"indexing"}
21+
assert expected_subset.issubset(set(default_dtypes.keys()))
2022

2123
devices = out.devices()
2224
assert isinstance(devices, list)

0 commit comments

Comments
 (0)