@@ -544,7 +544,8 @@ def test_a2f_scaled_unscaled():
544544 ):
545545 mn_in , mx_in = _dt_min_max (in_dtype )
546546 nan_val = np .nan if in_dtype in CFLOAT_TYPES else 10
547- arr = np .array ([mn_in , - 1 , 0 , 1 , mx_in , nan_val ], dtype = in_dtype )
547+ mn = 0 if np .dtype (in_dtype ).kind == "u" else 1
548+ arr = np .array ([mn_in , mn , 0 , 1 , mx_in , nan_val ], dtype = in_dtype )
548549 mn_out , mx_out = _dt_min_max (out_dtype )
549550 # 0 when scaled to output will also be the output value for NaN
550551 nan_fill = - intercept / divslope
@@ -738,9 +739,10 @@ def test_apply_scaling():
738739 f32_arr = np .zeros ((1 ,), dtype = f32 )
739740 i16_arr = np .zeros ((1 ,), dtype = np .int16 )
740741 # Check float upcast (not the normal numpy scalar rule)
741- # This is the normal rule - no upcast from scalar
742- assert (f32_arr * f64 (1 )).dtype == np .float32
743- assert (f32_arr + f64 (1 )).dtype == np .float32
742+ # This is the normal rule - no upcast from Python scalar
743+ # (on NumPy 2.0 it *will* upcast from a np.float64 scalar!)
744+ assert (f32_arr * 1. ).dtype == np .float32
745+ assert (f32_arr + 1. ).dtype == np .float32
744746 # The function does upcast though
745747 ret = apply_read_scaling (np .float32 (0 ), np .float64 (2 ))
746748 assert ret .dtype == np .float64
0 commit comments