Skip to content

Commit 78c57d0

Browse files
committed
hypothesis_helper dtype strats just alias xps strats
1 parent 03b735f commit 78c57d0

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

array_api_tests/hypothesis_helpers.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,15 @@
2626
# work for floating point dtypes as those are assumed to be defined in other
2727
# places in the tests.
2828
FILTER_UNDEFINED_DTYPES = True
29-
30-
integer_dtypes = sampled_from(dh.all_int_dtypes)
31-
floating_dtypes = sampled_from(dh.float_dtypes)
32-
numeric_dtypes = sampled_from(dh.numeric_dtypes)
33-
integer_or_boolean_dtypes = sampled_from(dh.bool_and_all_int_dtypes)
34-
boolean_dtypes = just(xp.bool)
35-
dtypes = sampled_from(dh.all_dtypes)
36-
37-
if FILTER_UNDEFINED_DTYPES:
38-
integer_dtypes = integer_dtypes.filter(lambda x: not isinstance(x, _UndefinedStub))
39-
floating_dtypes = floating_dtypes.filter(lambda x: not isinstance(x, _UndefinedStub))
40-
numeric_dtypes = numeric_dtypes.filter(lambda x: not isinstance(x, _UndefinedStub))
41-
integer_or_boolean_dtypes = integer_or_boolean_dtypes.filter(lambda x: not
42-
isinstance(x, _UndefinedStub))
43-
boolean_dtypes = boolean_dtypes.filter(lambda x: not isinstance(x, _UndefinedStub))
44-
dtypes = dtypes.filter(lambda x: not isinstance(x, _UndefinedStub))
29+
# TODO: currently we assume this to be true - we probably can remove this completely
30+
assert FILTER_UNDEFINED_DTYPES
31+
32+
integer_dtypes = xps.integer_dtypes() | xps.unsigned_integer_dtypes()
33+
floating_dtypes = xps.floating_dtypes()
34+
numeric_dtypes = xps.numeric_dtypes()
35+
integer_or_boolean_dtypes = xps.boolean_dtypes() | integer_dtypes
36+
boolean_dtypes = xps.boolean_dtypes()
37+
dtypes = xps.scalar_dtypes()
4538

4639
shared_dtypes = shared(dtypes, key="dtype")
4740
shared_floating_dtypes = shared(floating_dtypes, key="dtype")

0 commit comments

Comments
 (0)