|
22 | 22 | from .pytest_helpers import nargs
|
23 | 23 | from .typing import Array, DataType, Shape
|
24 | 24 |
|
25 |
| -# Set this to True to not fail tests just because a dtype isn't implemented. |
26 |
| -# If no compatible dtype is implemented for a given test, the test will fail |
27 |
| -# with a hypothesis health check error. Note that this functionality will not |
28 |
| -# work for floating point dtypes as those are assumed to be defined in other |
29 |
| -# places in the tests. |
30 |
| -FILTER_UNDEFINED_DTYPES = True |
31 |
| -# TODO: currently we assume this to be true - we probably can remove this completely |
32 |
| -assert FILTER_UNDEFINED_DTYPES |
33 |
| - |
34 | 25 | integer_dtypes = xps.integer_dtypes() | xps.unsigned_integer_dtypes()
|
35 | 26 | floating_dtypes = xps.floating_dtypes()
|
36 | 27 | numeric_dtypes = xps.numeric_dtypes()
|
@@ -62,21 +53,19 @@ def _dtypes_sorter(dtype_pair: Tuple[DataType, DataType]):
|
62 | 53 | return key
|
63 | 54 |
|
64 | 55 | _promotable_dtypes = list(dh.promotion_table.keys())
|
65 |
| -if FILTER_UNDEFINED_DTYPES: |
66 |
| - _promotable_dtypes = [ |
67 |
| - (d1, d2) for d1, d2 in _promotable_dtypes |
68 |
| - if not isinstance(d1, _UndefinedStub) or not isinstance(d2, _UndefinedStub) |
69 |
| - ] |
| 56 | +_promotable_dtypes = [ |
| 57 | + (d1, d2) for d1, d2 in _promotable_dtypes |
| 58 | + if not isinstance(d1, _UndefinedStub) or not isinstance(d2, _UndefinedStub) |
| 59 | +] |
70 | 60 | promotable_dtypes: List[Tuple[DataType, DataType]] = sorted(_promotable_dtypes, key=_dtypes_sorter)
|
71 | 61 |
|
72 | 62 | def mutually_promotable_dtypes(
|
73 | 63 | max_size: Optional[int] = 2,
|
74 | 64 | *,
|
75 | 65 | dtypes: Sequence[DataType] = dh.all_dtypes,
|
76 | 66 | ) -> SearchStrategy[Tuple[DataType, ...]]:
|
77 |
| - if FILTER_UNDEFINED_DTYPES: |
78 |
| - dtypes = [d for d in dtypes if not isinstance(d, _UndefinedStub)] |
79 |
| - assert len(dtypes) > 0, "all dtypes undefined" # sanity check |
| 67 | + dtypes = [d for d in dtypes if not isinstance(d, _UndefinedStub)] |
| 68 | + assert len(dtypes) > 0, "all dtypes undefined" # sanity check |
80 | 69 | if max_size == 2:
|
81 | 70 | return sampled_from(
|
82 | 71 | [(i, j) for i, j in promotable_dtypes if i in dtypes and j in dtypes]
|
@@ -424,9 +413,8 @@ def two_mutual_arrays(
|
424 | 413 | ) -> Tuple[SearchStrategy[Array], SearchStrategy[Array]]:
|
425 | 414 | if not isinstance(dtypes, Sequence):
|
426 | 415 | raise TypeError(f"{dtypes=} not a sequence")
|
427 |
| - if FILTER_UNDEFINED_DTYPES: |
428 |
| - dtypes = [d for d in dtypes if not isinstance(d, _UndefinedStub)] |
429 |
| - assert len(dtypes) > 0 # sanity check |
| 416 | + dtypes = [d for d in dtypes if not isinstance(d, _UndefinedStub)] |
| 417 | + assert len(dtypes) > 0 # sanity check |
430 | 418 | mutual_dtypes = shared(mutually_promotable_dtypes(dtypes=dtypes))
|
431 | 419 | mutual_shapes = shared(two_shapes)
|
432 | 420 | arrays1 = xps.arrays(
|
|
0 commit comments