@@ -142,7 +142,10 @@ def validate_array_interface_with_dtype(self, pmaker, params):
142142 for dtype in np .sctypes ['float' ] + np .sctypes ['int' ] + np .sctypes ['uint' ]:
143143 # Directly coerce with a dtype
144144 direct = dtype (prox )
145- assert_almost_equal (direct , orig .astype (dtype ))
145+ # Half-precision is imprecise. Obviously. It's a bad idea, but don't break
146+ # the test over it.
147+ rtol = 1e-03 if dtype == np .float16 else 1e-05
148+ assert_allclose (direct , orig .astype (dtype ), rtol = rtol , atol = 1e-08 )
146149 assert_dt_equal (direct .dtype , np .dtype (dtype ))
147150 assert_equal (direct .shape , params ['shape' ])
148151 # All three methods should produce equivalent results
@@ -153,25 +156,6 @@ def validate_array_interface_with_dtype(self, pmaker, params):
153156 # Shape matches expected shape
154157 assert_equal (out .shape , params ['shape' ])
155158
156- def validate_get_scaled (self , pmaker , params ):
157- # Check proxy returns expected array from asarray
158- prox , fio , hdr = pmaker ()
159- out = prox .get_scaled ()
160- assert_array_equal (out , params ['arr_out' ])
161- assert_dt_equal (out .dtype , params ['dtype_out' ])
162- # Shape matches expected shape
163- assert_equal (out .shape , params ['shape' ])
164-
165- for dtype in np .sctypes ['float' ] + np .sctypes ['int' ] + np .sctypes ['uint' ]:
166- out = prox .get_scaled (dtype = dtype )
167- # Half-precision is imprecise. Obviously. It's a bad idea, but don't break
168- # the test over it.
169- rtol = 1e-03 if dtype == np .float16 else 1e-05
170- assert_allclose (out , params ['arr_out' ].astype (out .dtype ), rtol = rtol , atol = 1e-08 )
171- assert_greater_equal (out .dtype , np .dtype (dtype ))
172- # Shape matches expected shape
173- assert_equal (out .shape , params ['shape' ])
174-
175159 def validate_header_isolated (self , pmaker , params ):
176160 # Confirm altering input header has no effect
177161 # Depends on header providing 'get_data_dtype', 'set_data_dtype',
0 commit comments