12
12
required, but we don't yet have a clean way to disable only those tests (see https://github.com/data-apis/array-api-tests/issues/25).
13
13
14
14
"""
15
+ # TODO: test with complex dtypes where appropiate
15
16
16
17
import pytest
17
18
from hypothesis import assume , given
20
21
from ndindex import iter_indices
21
22
22
23
from .array_helpers import assert_exactly_equal , asarray
23
- from .hypothesis_helpers import (xps , dtypes , shapes , kwargs , matrix_shapes ,
24
+ from .hypothesis_helpers import (xps , shapes , kwargs , matrix_shapes ,
24
25
square_matrix_shapes , symmetric_matrices ,
25
26
positive_definite_matrices , MAX_ARRAY_SIZE ,
26
27
invertible_matrices , two_mutual_arrays ,
@@ -117,7 +118,7 @@ def test_cholesky(x, kw):
117
118
118
119
119
120
@composite
120
- def cross_args (draw , dtype_objects = dh .numeric_dtypes ):
121
+ def cross_args (draw , dtype_objects = dh .real_dtypes ):
121
122
"""
122
123
cross() requires two arrays with a size 3 in the 'axis' dimension
123
124
@@ -192,7 +193,7 @@ def test_det(x):
192
193
193
194
@pytest .mark .xp_extension ('linalg' )
194
195
@given (
195
- x = xps .arrays (dtype = dtypes , shape = matrix_shapes ()),
196
+ x = xps .arrays (dtype = xps . real_dtypes () , shape = matrix_shapes ()),
196
197
# offset may produce an overflow if it is too large. Supporting offsets
197
198
# that are way larger than the array shape isn't very important.
198
199
kw = kwargs (offset = integers (- MAX_ARRAY_SIZE , MAX_ARRAY_SIZE ))
@@ -277,7 +278,7 @@ def test_inv(x):
277
278
# TODO: Test that the result is actually the inverse
278
279
279
280
@given (
280
- * two_mutual_arrays (dh .numeric_dtypes )
281
+ * two_mutual_arrays (dh .real_dtypes )
281
282
)
282
283
def test_matmul (x1 , x2 ):
283
284
# TODO: Make this also test the @ operator
@@ -366,7 +367,7 @@ def test_matrix_rank(x, kw):
366
367
linalg .matrix_rank (x , ** kw )
367
368
368
369
@given (
369
- x = xps .arrays (dtype = dtypes , shape = matrix_shapes ()),
370
+ x = xps .arrays (dtype = xps . real_dtypes () , shape = matrix_shapes ()),
370
371
)
371
372
def test_matrix_transpose (x ):
372
373
res = _array_module .matrix_transpose (x )
@@ -384,7 +385,7 @@ def test_matrix_transpose(x):
384
385
385
386
@pytest .mark .xp_extension ('linalg' )
386
387
@given (
387
- * two_mutual_arrays (dtypes = dh .numeric_dtypes ,
388
+ * two_mutual_arrays (dtypes = dh .real_dtypes ,
388
389
two_shapes = tuples (one_d_shapes , one_d_shapes ))
389
390
)
390
391
def test_outer (x1 , x2 ):
@@ -573,7 +574,7 @@ def test_svdvals(x):
573
574
574
575
575
576
@given (
576
- dtypes = mutually_promotable_dtypes (dtypes = dh .numeric_dtypes ),
577
+ dtypes = mutually_promotable_dtypes (dtypes = dh .real_dtypes ),
577
578
shape = shapes (),
578
579
data = data (),
579
580
)
@@ -590,7 +591,7 @@ def test_tensordot(dtypes, shape, data):
590
591
591
592
@pytest .mark .xp_extension ('linalg' )
592
593
@given (
593
- x = xps .arrays (dtype = xps .numeric_dtypes (), shape = matrix_shapes ()),
594
+ x = xps .arrays (dtype = xps .real_dtypes (), shape = matrix_shapes ()),
594
595
# offset may produce an overflow if it is too large. Supporting offsets
595
596
# that are way larger than the array shape isn't very important.
596
597
kw = kwargs (offset = integers (- MAX_ARRAY_SIZE , MAX_ARRAY_SIZE ))
@@ -629,7 +630,7 @@ def true_trace(x_stack):
629
630
630
631
631
632
@given (
632
- dtypes = mutually_promotable_dtypes (dtypes = dh .numeric_dtypes ),
633
+ dtypes = mutually_promotable_dtypes (dtypes = dh .real_dtypes ),
633
634
shape = shapes (min_dims = 1 ),
634
635
data = data (),
635
636
)
0 commit comments