Skip to content

Commit 8a61100

Browse files
committed
reuse dh.all_dtypes
1 parent 5120204 commit 8a61100

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

Diff for: array_api_tests/test_data_type_functions.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ def non_complex_dtypes():
1919
return xps.boolean_dtypes() | hh.real_dtypes
2020

2121

22-
def numeric_dtypes():
23-
return xps.boolean_dtypes() | hh.real_dtypes | hh.complex_dtypes
24-
25-
2622
def float32(n: Union[int, float]) -> float:
2723
return struct.unpack("!f", struct.pack("!f", float(n)))[0]
2824

@@ -115,13 +111,9 @@ def test_broadcast_to(x, data):
115111
# TODO: test values
116112

117113

118-
@given(_from=numeric_dtypes(), to=numeric_dtypes(), data=st.data())
119-
def test_can_cast(_from, to, data):
120-
from_ = data.draw(
121-
st.just(_from) | hh.arrays(dtype=_from, shape=hh.shapes()), label="from_"
122-
)
123-
124-
out = xp.can_cast(from_, to)
114+
@given(_from=hh.all_dtypes, to=hh.all_dtypes)
115+
def test_can_cast(_from, to):
116+
out = xp.can_cast(_from, to)
125117

126118
f_func = f"[can_cast({dh.dtype_to_name[_from]}, {dh.dtype_to_name[to]})]"
127119
assert isinstance(out, bool), f"{type(out)=}, but should be bool {f_func}"

0 commit comments

Comments
 (0)