Skip to content

Do not require default dtype if no dtypes in kind supported #337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions array_api_tests/dtype_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion array_api_tests/test_inspection_functions.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)
Expand Down