Skip to content

Commit ce37065

Browse files
committed
Split out different types of dtypes
1 parent a964703 commit ce37065

2 files changed

Lines changed: 25 additions & 4 deletions

File tree

array_api_tests/_array_module.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,32 @@ def __repr__(self):
5353
__call__ = _raise
5454
__getattr__ = _raise
5555

56-
_dtypes = [
57-
'bool',
58-
'int8',
56+
_integer_dtypes = [
57+
'int8',
5958
'int16',
6059
'int32',
6160
'int64',
6261
'uint8',
6362
'uint16',
6463
'uint32',
6564
'uint64',
65+
]
66+
67+
_floating_dtypes = [
6668
'float32',
6769
'float64',
6870
]
6971

72+
_numeric_dtypes = [
73+
*_integer_dtypes,
74+
*_floating_dtypes,
75+
]
76+
77+
_dtypes = [
78+
'bool',
79+
*_numeric_dtypes
80+
]
81+
7082
for func_name in function_stubs.__all__ + _dtypes:
7183
try:
7284
globals()[func_name] = getattr(mod, func_name)

array_api_tests/hypothesis_helpers.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,22 @@
77
from hypothesis import assume
88

99
from .pytest_helpers import nargs
10-
from ._array_module import _dtypes, ones, full
10+
from ._array_module import (_integer_dtypes, _floating_dtypes,
11+
_numeric_dtypes, _dtypes, ones, full)
1112
from . import _array_module
1213

1314
from .function_stubs import elementwise_functions
1415

16+
integer_dtype_objects = [getattr(_array_module, t) for t in _integer_dtypes]
17+
floating_dtype_objects = [getattr(_array_module, t) for t in _floating_dtypes]
18+
numeric_dtype_objects = [getattr(_array_module, t) for t in _numeric_dtypes]
1519
dtype_objects = [getattr(_array_module, t) for t in _dtypes]
20+
21+
integer_dtypes = sampled_from(integer_dtype_objects)
22+
floating_dtypes = sampled_from(floating_dtype_objects)
23+
numeric_dtypes = sampled_from(numeric_dtype_objects)
1624
dtypes = sampled_from(dtype_objects)
25+
1726
shared_dtypes = shared(dtypes)
1827

1928
# shared() allows us to draw either the function or the function name and they

0 commit comments

Comments
 (0)