|
9 | 9 |
|
10 | 10 | from hypothesis import assume, reject |
11 | 11 | from hypothesis.strategies import (SearchStrategy, booleans, composite, floats, |
12 | | - integers, just, lists, none, one_of, |
13 | | - sampled_from, shared, builds, nothing) |
| 12 | + integers, complex_numbers, just, lists, none, one_of, |
| 13 | + sampled_from, shared, builds, nothing, permutations) |
14 | 14 |
|
15 | 15 | from . import _array_module as xp, api_version |
16 | 16 | from . import array_helpers as ah |
@@ -148,6 +148,13 @@ def mutually_promotable_dtypes( |
148 | 148 | return one_of(strats).map(tuple) |
149 | 149 |
|
150 | 150 |
|
| 151 | +@composite |
| 152 | +def pair_of_mutually_promotable_dtypes(draw, max_size=2, *, dtypes=dh.all_dtypes): |
| 153 | + sample = draw(mutually_promotable_dtypes( max_size, dtypes=dtypes)) |
| 154 | + permuted = draw(permutations(sample)) |
| 155 | + return sample, permuted |
| 156 | + |
| 157 | + |
151 | 158 | class OnewayPromotableDtypes(NamedTuple): |
152 | 159 | input_dtype: DataType |
153 | 160 | result_dtype: DataType |
|
0 commit comments