1313 make_array_writer , get_slope_inter )
1414from ..casting import int_abs , type_info , shared_range , on_powerpc
1515from ..volumeutils import array_from_file , apply_read_scaling , _dt_min_max
16+ from ..deprecator import ExpiredDeprecationError
1617
1718from numpy .testing import assert_array_almost_equal , assert_array_equal
1819import pytest
19- from ..testing import (assert_allclose_safely , suppress_warnings ,
20- error_warnings )
20+ from ..testing import assert_allclose_safely , suppress_warnings
2121
2222
2323FLOAT_TYPES = np .sctypes ['float' ]
@@ -506,12 +506,11 @@ def test_nan2zero():
506506 aw = awt (arr , np .float32 , ** kwargs )
507507 data_back = round_trip (aw )
508508 assert_array_equal (np .isnan (data_back ), [True , False ])
509- # Deprecation warning for nan2zero as argument to `to_fileobj`
510- with error_warnings ():
511- with pytest .deprecated_call ():
512- aw .to_fileobj (BytesIO (), 'F' , True )
513- with pytest .deprecated_call ():
514- aw .to_fileobj (BytesIO (), 'F' , nan2zero = True )
509+ # Expired deprecation error for nan2zero as argument to `to_fileobj`
510+ with pytest .raises (ExpiredDeprecationError ):
511+ aw .to_fileobj (BytesIO (), 'F' , True )
512+ with pytest .raises (ExpiredDeprecationError ):
513+ aw .to_fileobj (BytesIO (), 'F' , nan2zero = True )
515514 # Error if nan2zero is not the value set at initialization
516515 with pytest .raises (WriterError ):
517516 aw .to_fileobj (BytesIO (), 'F' , False )
@@ -528,12 +527,11 @@ def test_nan2zero():
528527 data_back = round_trip (aw )
529528 astype_res = np .array (np .nan ).astype (np .int32 )
530529 assert_array_equal (data_back , [astype_res , 99 ])
531- # Deprecation warning for nan2zero as argument to `to_fileobj`
532- with error_warnings ():
533- with pytest .deprecated_call ():
534- aw .to_fileobj (BytesIO (), 'F' , False )
535- with pytest .deprecated_call ():
536- aw .to_fileobj (BytesIO (), 'F' , nan2zero = False )
530+ # Expired deprecation error for nan2zero as argument to `to_fileobj`
531+ with pytest .raises (ExpiredDeprecationError ):
532+ aw .to_fileobj (BytesIO (), 'F' , False )
533+ with pytest .raises (ExpiredDeprecationError ):
534+ aw .to_fileobj (BytesIO (), 'F' , nan2zero = False )
537535 # Error if nan2zero is not the value set at initialization
538536 with pytest .raises (WriterError ):
539537 aw .to_fileobj (BytesIO (), 'F' , True )
0 commit comments