-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #255 from honno/2023-coverage
2023.12 coverage
- Loading branch information
Showing
5 changed files
with
203 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import pytest | ||
from hypothesis import given, strategies as st | ||
|
||
from . import xp | ||
|
||
pytestmark = pytest.mark.min_version("2023.12") | ||
|
||
|
||
def test_array_namespace_info(): | ||
out = xp.__array_namespace_info__() | ||
|
||
capabilities = out.capabilities() | ||
assert isinstance(capabilities, dict) | ||
|
||
out.default_device() | ||
|
||
default_dtypes = out.default_dtypes() | ||
assert isinstance(default_dtypes, dict) | ||
assert {"real floating", "complex floating", "integral", "indexing"}.issubset(set(default_dtypes.keys())) | ||
|
||
devices = out.devices() | ||
assert isinstance(devices, list) | ||
|
||
|
||
atomic_kinds = [ | ||
"bool", | ||
"signed integer", | ||
"unsigned integer", | ||
"real floating", | ||
"complex floating", | ||
] | ||
|
||
|
||
@given( | ||
st.one_of( | ||
st.none(), | ||
st.sampled_from(atomic_kinds + ["integral", "numeric"]), | ||
st.lists(st.sampled_from(atomic_kinds), unique=True, min_size=1).map(tuple), | ||
) | ||
) | ||
def test_array_namespace_info_dtypes(kind): | ||
out = xp.__array_namespace_info__().dtypes(kind=kind) | ||
assert isinstance(out, dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters