@@ -898,31 +898,32 @@ def test_operator_scalars(op, type1, type2):
898
898
899
899
900
900
@pytest .mark .parametrize ("op" , reasonable_operators_for_scalars )
901
- @pytest .mark .parametrize ("val" , [None , 2 ** 64 ])
902
- def test_longdouble_inf_loop (op , val ):
903
- # Note: The 2**64 value will pass once NEP 50 is adopted.
901
+ @pytest .mark .parametrize ("sctype" , [np .longdouble , np .clongdouble ])
902
+ def test_longdouble_inf_loop (sctype , op ):
904
903
try :
905
- op (np . longdouble (3 ), val )
904
+ op (sctype (3 ), None )
906
905
except TypeError :
907
906
pass
908
907
try :
909
- op (val , np . longdouble (3 ))
908
+ op (None , sctype (3 ))
910
909
except TypeError :
911
910
pass
912
911
913
912
914
913
@pytest .mark .parametrize ("op" , reasonable_operators_for_scalars )
915
- @pytest .mark .parametrize ("val" , [None , 2 ** 64 ])
916
- def test_clongdouble_inf_loop (op , val ):
917
- # Note: The 2**64 value will pass once NEP 50 is adopted.
918
- try :
919
- op (np .clongdouble (3 ), val )
920
- except TypeError :
921
- pass
922
- try :
923
- op (val , np .longdouble (3 ))
924
- except TypeError :
925
- pass
914
+ @pytest .mark .parametrize ("sctype" , [np .longdouble , np .clongdouble ])
915
+ @np .errstate (all = "ignore" )
916
+ def test_longdouble_inf_loop (sctype , op ):
917
+ # NEP 50 means that the result is clearly a (c)longdouble here:
918
+ if sctype == np .clongdouble and op in [operator .mod , operator .floordiv ]:
919
+ # The above operators are not support for complex though...
920
+ with pytest .raises (TypeError ):
921
+ op (sctype (3 ), 2 ** 64 )
922
+ with pytest .raises (TypeError ):
923
+ op (sctype (3 ), 2 ** 64 )
924
+ else :
925
+ assert op (sctype (3 ), 2 ** 64 ) == op (sctype (3 ), sctype (2 ** 64 ))
926
+ assert op (2 ** 64 , sctype (3 )) == op (sctype (2 ** 64 ), sctype (3 ))
926
927
927
928
928
929
@pytest .mark .parametrize ("dtype" , np .typecodes ["AllInteger" ])
0 commit comments