@@ -413,7 +413,7 @@ def test_a2f_nan2zero():
413
413
# How weird? Look at arr.astype(np.int64)
414
414
with np .errstate (invalid = 'ignore' ):
415
415
data_back = write_return (arr , str_io , np .int64 , nan2zero = False )
416
- assert_array_equal (data_back , arr .astype (np .int64 ))
416
+ assert_array_equal (data_back , arr .astype (np .int64 ))
417
417
418
418
419
419
def test_a2f_nan2zero_scaling ():
@@ -692,9 +692,15 @@ def test_a2f_nan2zero_range():
692
692
write_return (arr_no_nan , fobj , np .int8 , intercept = 129 )
693
693
# OK with nan2zero false, but we get whatever nan casts to
694
694
with pytest .warns (warn_type ) if warn_type else error_warnings ():
695
- nan_cast = np .array (np .nan , dtype = dt ).astype (np .int8 )
695
+ # XXX NP1.24
696
+ # Casting nan to int will produce a RuntimeWarning in numpy 1.24
697
+ # Change to expecting this warning when this becomes our minimum
698
+ with np .errstate (invalid = 'ignore' ):
699
+ nan_cast = np .array (np .nan , dtype = dt ).astype (np .int8 )
696
700
with pytest .warns (warn_type ) if warn_type else error_warnings ():
697
- back_arr = write_return (arr , fobj , np .int8 , intercept = 129 , nan2zero = False )
701
+ # XXX NP1.24 - expect RuntimeWarning
702
+ with np .errstate (invalid = 'ignore' ):
703
+ back_arr = write_return (arr , fobj , np .int8 , intercept = 129 , nan2zero = False )
698
704
assert_array_equal ([- 128 , - 128 , - 128 , nan_cast ], back_arr )
699
705
# divslope
700
706
with pytest .warns (warn_type ) if warn_type else error_warnings ():
@@ -706,8 +712,10 @@ def test_a2f_nan2zero_range():
706
712
write_return (arr_no_nan , fobj , np .int8 , intercept = 257.1 , divslope = 2 )
707
713
# OK with nan2zero false
708
714
with pytest .warns (warn_type ) if warn_type else error_warnings ():
709
- back_arr = write_return (arr , fobj , np .int8 ,
710
- intercept = 257.1 , divslope = 2 , nan2zero = False )
715
+ # XXX NP1.24 - expect RuntimeWarning
716
+ with np .errstate (invalid = 'ignore' ):
717
+ back_arr = write_return (arr , fobj , np .int8 ,
718
+ intercept = 257.1 , divslope = 2 , nan2zero = False )
711
719
assert_array_equal ([- 128 , - 128 , - 128 , nan_cast ], back_arr )
712
720
713
721
0 commit comments