@@ -157,31 +157,25 @@ def test_array_file_scales(in_type, out_type):
157157 assert np .all (np .abs (arr - arr3 ) <= max_miss )
158158
159159
160- @pytest .mark .parametrize ("in_type, out_type" ,[
161- ('int' , 'int' ),
162- ('uint' , 'int' ),
163- ])
164- def test_scaling_in_abstract (in_type , out_type ):
160+ @pytest .mark .parametrize ("category0, category1, overflow" ,[
165161 # Confirm that, for all ints and uints as input, and all possible outputs,
166162 # for any simple way of doing the calculation, the result is near enough
167- for in_tp in np .sctypes [in_type ]:
168- for out_tp in np .sctypes [out_type ]:
169- check_int_a2f (in_tp , out_tp )
170-
171-
172- @pytest .mark .parametrize ("in_type, out_type" , [
173- ('float' , 'int' ),
174- ('float' , 'uint' ),
175- ('complex' , 'int' ),
176- ('complex' , 'uint' ),
177- ])
178- def test_scaling_in_abstract_warn (in_type , out_type ):
179-
163+ ('int' , 'int' , False ),
164+ ('uint' , 'int' , False ),
180165 # Converting floats to integer
181- for in_tp in np .sctypes [in_type ]:
182- for out_tp in np .sctypes [out_type ]:
183- with suppress_warnings (): # overflow
184- check_int_a2f (in_tp , out_tp )
166+ ('float' , 'int' , True ),
167+ ('float' , 'uint' , True ),
168+ ('complex' , 'int' , True ),
169+ ('complex' , 'uint' , True ),
170+ ])
171+ def test_scaling_in_abstract (category0 , category1 , overflow ):
172+ for in_type in np .sctypes [category0 ]:
173+ for out_type in np .sctypes [category1 ]:
174+ if overflow :
175+ with suppress_warnings ():
176+ check_int_a2f (in_type , out_type )
177+ else :
178+ check_int_a2f (in_type , out_type )
185179
186180
187181def check_int_a2f (in_type , out_type ):
0 commit comments