13
13
make_array_writer , get_slope_inter )
14
14
from ..casting import int_abs , type_info , shared_range , on_powerpc
15
15
from ..volumeutils import array_from_file , apply_read_scaling , _dt_min_max
16
+ from ..deprecator import ExpiredDeprecationError
16
17
17
18
from numpy .testing import assert_array_almost_equal , assert_array_equal
18
19
import pytest
19
- from ..testing import (assert_allclose_safely , suppress_warnings ,
20
- error_warnings )
20
+ from ..testing import assert_allclose_safely , suppress_warnings
21
21
22
22
23
23
FLOAT_TYPES = np .sctypes ['float' ]
@@ -506,12 +506,11 @@ def test_nan2zero():
506
506
aw = awt (arr , np .float32 , ** kwargs )
507
507
data_back = round_trip (aw )
508
508
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 )
515
514
# Error if nan2zero is not the value set at initialization
516
515
with pytest .raises (WriterError ):
517
516
aw .to_fileobj (BytesIO (), 'F' , False )
@@ -528,12 +527,11 @@ def test_nan2zero():
528
527
data_back = round_trip (aw )
529
528
astype_res = np .array (np .nan ).astype (np .int32 )
530
529
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 )
537
535
# Error if nan2zero is not the value set at initialization
538
536
with pytest .raises (WriterError ):
539
537
aw .to_fileobj (BytesIO (), 'F' , True )
0 commit comments