@@ -338,6 +338,7 @@ def test_generalized_sq_cases(self):
338
338
self .check_cases (require = {'generalized' , 'square' },
339
339
exclude = {'size-0' })
340
340
341
+ @pytest .mark .xfail (reason = "zero-size arrays" )
341
342
@pytest .mark .slow
342
343
def test_generalized_empty_sq_cases (self ):
343
344
self .check_cases (require = {'generalized' , 'square' , 'size-0' })
@@ -357,11 +358,13 @@ def test_generalized_empty_nonsq_cases(self):
357
358
358
359
class HermitianGeneralizedTestCase (LinalgTestCase ):
359
360
361
+ @pytest .mark .xfail (reason = "sort complex" )
360
362
@pytest .mark .slow
361
363
def test_generalized_herm_cases (self ):
362
364
self .check_cases (require = {'generalized' , 'hermitian' },
363
365
exclude = {'size-0' })
364
366
367
+ @pytest .mark .xfail (reason = "zero-size arrays" )
365
368
@pytest .mark .slow
366
369
def test_generalized_empty_herm_cases (self ):
367
370
self .check_cases (require = {'generalized' , 'hermitian' , 'size-0' },
@@ -637,7 +640,7 @@ def hermitian(mat):
637
640
638
641
assert_almost_equal (np .matmul (u , hermitian (u )), np .broadcast_to (np .eye (u .shape [- 1 ]), u .shape ))
639
642
assert_almost_equal (np .matmul (vt , hermitian (vt )), np .broadcast_to (np .eye (vt .shape [- 1 ]), vt .shape ))
640
- assert_equal (np .sort (s )[..., :: - 1 ], s )
643
+ assert_equal (np .sort (s ), np . flip ( s , - 1 ) )
641
644
assert_ (consistent_subclass (u , a ))
642
645
assert_ (consistent_subclass (vt , a ))
643
646
@@ -802,8 +805,8 @@ def do(self, a, b, tags):
802
805
else :
803
806
ad = asarray (a ).astype (cdouble )
804
807
ev = linalg .eigvals (ad )
805
- assert_almost_equal (d , multiply . reduce (ev , axis = - 1 ))
806
- assert_almost_equal (s * np .exp (ld ), multiply . reduce (ev , axis = - 1 ))
808
+ assert_almost_equal (d , np . prod (ev , axis = - 1 ))
809
+ assert_almost_equal (s * np .exp (ld ), np . prod (ev , axis = - 1 ))
807
810
808
811
s = np .atleast_1d (s )
809
812
ld = np .atleast_1d (ld )
@@ -855,14 +858,6 @@ def test_0_size(self):
855
858
assert_ (res [1 ].dtype .type is np .float64 )
856
859
857
860
858
- # stub out these two tests inherited from superclasses
859
- def test_empty_sq_cases (self ):
860
- pytest .xfail ("multiply.reduce" )
861
-
862
- def test_sq_cases (self ):
863
- pytest .xfail ("multiply.reduce" )
864
-
865
-
866
861
class LstsqCases (LinalgSquareTestCase , LinalgNonsquareTestCase ):
867
862
868
863
def do (self , a , b , tags ):
@@ -1776,7 +1771,7 @@ def test_0_size(self):
1776
1771
assert_ (isinstance (res , np .ndarray ))
1777
1772
1778
1773
1779
- @pytest .mark .xfail (reason = 'TODO ' )
1774
+ @pytest .mark .xfail (reason = 'endianness ' )
1780
1775
def test_byteorder_check ():
1781
1776
# Byte order check should pass for native order
1782
1777
if sys .byteorder == 'little' :
@@ -1798,7 +1793,6 @@ def test_byteorder_check():
1798
1793
assert_array_equal (res , routine (sw_arr ))
1799
1794
1800
1795
1801
- @pytest .mark .xfail (reason = 'TODO' )
1802
1796
@pytest .mark .skipif (IS_WASM , reason = "fp errors don't work in wasm" )
1803
1797
def test_generalized_raise_multiloop ():
1804
1798
# It should raise an error even if the error doesn't occur in the
@@ -1814,7 +1808,6 @@ def test_generalized_raise_multiloop():
1814
1808
assert_raises (np .linalg .LinAlgError , np .linalg .inv , x )
1815
1809
1816
1810
1817
- @pytest .mark .xfail (reason = 'TODO' )
1818
1811
def test_xerbla_override ():
1819
1812
# Check that our xerbla has been successfully linked in. If it is not,
1820
1813
# the default xerbla routine is called, which prints a message to stdout
@@ -1864,7 +1857,6 @@ def test_xerbla_override():
1864
1857
pytest .skip ('Numpy xerbla not linked in.' )
1865
1858
1866
1859
1867
- @pytest .mark .xfail (reason = 'TODO' )
1868
1860
@pytest .mark .skipif (IS_WASM , reason = "Cannot start subprocess" )
1869
1861
@pytest .mark .slow
1870
1862
def test_sdot_bug_8577 ():
@@ -1901,7 +1893,6 @@ def test_sdot_bug_8577():
1901
1893
subprocess .check_call ([sys .executable , "-c" , code ])
1902
1894
1903
1895
1904
- @pytest .mark .xfail (reason = 'TODO' )
1905
1896
class TestMultiDot :
1906
1897
1907
1898
def test_basic_function_with_three_arguments (self ):
@@ -2027,19 +2018,18 @@ def test_dynamic_programming_logic(self):
2027
2018
assert_almost_equal (np .triu (m ), np .triu (m_expected ))
2028
2019
2029
2020
def test_too_few_input_arrays (self ):
2030
- assert_raises (ValueError , multi_dot , [])
2031
- assert_raises (ValueError , multi_dot , [np .random .random ((3 , 3 ))])
2021
+ assert_raises (( RuntimeError , ValueError ) , multi_dot , [])
2022
+ assert_raises (( RuntimeError , ValueError ) , multi_dot , [np .random .random ((3 , 3 ))])
2032
2023
2033
2024
2034
- @pytest .mark .xfail (reason = 'TODO' )
2035
2025
class TestTensorinv :
2036
2026
2037
2027
@pytest .mark .parametrize ("arr, ind" , [
2038
2028
(np .ones ((4 , 6 , 8 , 2 )), 2 ),
2039
2029
(np .ones ((3 , 3 , 2 )), 1 ),
2040
2030
])
2041
2031
def test_non_square_handling (self , arr , ind ):
2042
- with assert_raises (LinAlgError ):
2032
+ with assert_raises (( LinAlgError , RuntimeError ) ):
2043
2033
linalg .tensorinv (arr , ind = ind )
2044
2034
2045
2035
@pytest .mark .parametrize ("shape, ind" , [
@@ -2048,8 +2038,7 @@ def test_non_square_handling(self, arr, ind):
2048
2038
((24 , 8 , 3 ), 1 ),
2049
2039
])
2050
2040
def test_tensorinv_shape (self , shape , ind ):
2051
- a = np .eye (24 )
2052
- a .shape = shape
2041
+ a = np .eye (24 ).reshape (shape )
2053
2042
ainv = linalg .tensorinv (a = a , ind = ind )
2054
2043
expected = a .shape [ind :] + a .shape [:ind ]
2055
2044
actual = ainv .shape
@@ -2059,29 +2048,26 @@ def test_tensorinv_shape(self, shape, ind):
2059
2048
0 , - 2 ,
2060
2049
])
2061
2050
def test_tensorinv_ind_limit (self , ind ):
2062
- a = np .eye (24 )
2063
- a .shape = (4 , 6 , 8 , 3 )
2064
- with assert_raises (ValueError ):
2051
+ a = np .eye (24 ).reshape (4 , 6 , 8 , 3 )
2052
+ with assert_raises ((ValueError , RuntimeError )):
2065
2053
linalg .tensorinv (a = a , ind = ind )
2066
2054
2067
2055
def test_tensorinv_result (self ):
2068
2056
# mimic a docstring example
2069
- a = np .eye (24 )
2070
- a .shape = (24 , 8 , 3 )
2057
+ a = np .eye (24 ).reshape (24 , 8 , 3 )
2071
2058
ainv = linalg .tensorinv (a , ind = 1 )
2072
2059
b = np .ones (24 )
2073
2060
assert_allclose (np .tensordot (ainv , b , 1 ), np .linalg .tensorsolve (a , b ))
2074
2061
2075
2062
2076
- @pytest .mark .xfail (reason = 'TODO' )
2077
2063
class TestTensorsolve :
2078
2064
2079
2065
@pytest .mark .parametrize ("a, axes" , [
2080
2066
(np .ones ((4 , 6 , 8 , 2 )), None ),
2081
2067
(np .ones ((3 , 3 , 2 )), (0 , 2 )),
2082
2068
])
2083
2069
def test_non_square_handling (self , a , axes ):
2084
- with assert_raises (LinAlgError ):
2070
+ with assert_raises (( LinAlgError , RuntimeError ) ):
2085
2071
b = np .ones (a .shape [:2 ])
2086
2072
linalg .tensorsolve (a , b , axes = axes )
2087
2073
@@ -2119,7 +2105,7 @@ def test_blas64_dot():
2119
2105
assert_equal (c [0 ,- 1 ], 1 )
2120
2106
2121
2107
2122
- @pytest .mark .xfail (reason = 'TODO ' )
2108
+ @pytest .mark .skip (reason = 'lapack-lite specific ' )
2123
2109
@pytest .mark .xfail (not HAS_LAPACK64 ,
2124
2110
reason = "Numpy not compiled with 64-bit BLAS/LAPACK" )
2125
2111
def test_blas64_geqrf_lwork_smoketest ():
0 commit comments