1212required, 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).
1313
1414"""
15+ # TODO: test with complex dtypes where appropiate
1516
1617import pytest
1718from hypothesis import assume , given
2021from ndindex import iter_indices
2122
2223from .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 ,
2425 square_matrix_shapes , symmetric_matrices ,
2526 positive_definite_matrices , MAX_ARRAY_SIZE ,
2627 invertible_matrices , two_mutual_arrays ,
@@ -117,7 +118,7 @@ def test_cholesky(x, kw):
117118
118119
119120@composite
120- def cross_args (draw , dtype_objects = dh .numeric_dtypes ):
121+ def cross_args (draw , dtype_objects = dh .real_dtypes ):
121122 """
122123 cross() requires two arrays with a size 3 in the 'axis' dimension
123124
@@ -192,7 +193,7 @@ def test_det(x):
192193
193194@pytest .mark .xp_extension ('linalg' )
194195@given (
195- x = xps .arrays (dtype = dtypes , shape = matrix_shapes ()),
196+ x = xps .arrays (dtype = xps . real_dtypes () , shape = matrix_shapes ()),
196197 # offset may produce an overflow if it is too large. Supporting offsets
197198 # that are way larger than the array shape isn't very important.
198199 kw = kwargs (offset = integers (- MAX_ARRAY_SIZE , MAX_ARRAY_SIZE ))
@@ -277,7 +278,7 @@ def test_inv(x):
277278 # TODO: Test that the result is actually the inverse
278279
279280@given (
280- * two_mutual_arrays (dh .numeric_dtypes )
281+ * two_mutual_arrays (dh .real_dtypes )
281282)
282283def test_matmul (x1 , x2 ):
283284 # TODO: Make this also test the @ operator
@@ -366,7 +367,7 @@ def test_matrix_rank(x, kw):
366367 linalg .matrix_rank (x , ** kw )
367368
368369@given (
369- x = xps .arrays (dtype = dtypes , shape = matrix_shapes ()),
370+ x = xps .arrays (dtype = xps . real_dtypes () , shape = matrix_shapes ()),
370371)
371372def test_matrix_transpose (x ):
372373 res = _array_module .matrix_transpose (x )
@@ -384,7 +385,7 @@ def test_matrix_transpose(x):
384385
385386@pytest .mark .xp_extension ('linalg' )
386387@given (
387- * two_mutual_arrays (dtypes = dh .numeric_dtypes ,
388+ * two_mutual_arrays (dtypes = dh .real_dtypes ,
388389 two_shapes = tuples (one_d_shapes , one_d_shapes ))
389390)
390391def test_outer (x1 , x2 ):
@@ -573,7 +574,7 @@ def test_svdvals(x):
573574
574575
575576@given (
576- dtypes = mutually_promotable_dtypes (dtypes = dh .numeric_dtypes ),
577+ dtypes = mutually_promotable_dtypes (dtypes = dh .real_dtypes ),
577578 shape = shapes (),
578579 data = data (),
579580)
@@ -590,7 +591,7 @@ def test_tensordot(dtypes, shape, data):
590591
591592@pytest .mark .xp_extension ('linalg' )
592593@given (
593- x = xps .arrays (dtype = xps .numeric_dtypes (), shape = matrix_shapes ()),
594+ x = xps .arrays (dtype = xps .real_dtypes (), shape = matrix_shapes ()),
594595 # offset may produce an overflow if it is too large. Supporting offsets
595596 # that are way larger than the array shape isn't very important.
596597 kw = kwargs (offset = integers (- MAX_ARRAY_SIZE , MAX_ARRAY_SIZE ))
@@ -629,7 +630,7 @@ def true_trace(x_stack):
629630
630631
631632@given (
632- dtypes = mutually_promotable_dtypes (dtypes = dh .numeric_dtypes ),
633+ dtypes = mutually_promotable_dtypes (dtypes = dh .real_dtypes ),
633634 shape = shapes (min_dims = 1 ),
634635 data = data (),
635636)
0 commit comments