@@ -82,19 +82,6 @@ class TestNifti1PairHeader(tana.TestAnalyzeHeader, tspm.HeaderScalingMixin):
8282 np .longcomplex ))
8383 tana .add_intp (supported_np_types )
8484
85- def setUp (self ):
86- # Add warning filters for duration of test case
87- self ._wctx = warnings .catch_warnings ()
88- self ._wctx .__enter__ ()
89- warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
90- warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
91- warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
92- UserWarning )
93-
94- def tearDown (self ):
95- # Restore warning filters
96- self ._wctx .__exit__ ()
97-
9885 def test_empty (self ):
9986 tana .TestAnalyzeHeader .test_empty (self )
10087 hdr = self .header_class ()
@@ -720,6 +707,30 @@ def test_recoded_fields(self):
720707 assert_equal (hdr .get_value_label ('slice_code' ),
721708 'alternating decreasing' )
722709
710+ def test_general_init (self ):
711+ with clear_and_catch_warnings () as warns :
712+ warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
713+ warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
714+ warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
715+ UserWarning )
716+ super (TestNifti1PairHeader , self ).test_general_init ()
717+
718+ def test_from_header (self ):
719+ with clear_and_catch_warnings () as warns :
720+ warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
721+ warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
722+ warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
723+ UserWarning )
724+ super (TestNifti1PairHeader , self ).test_from_header ()
725+
726+ def test_data_shape_zooms_affine (self ):
727+ with clear_and_catch_warnings () as warns :
728+ warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
729+ warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
730+ warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
731+ UserWarning )
732+ super (TestNifti1PairHeader , self ).test_data_shape_zooms_affine ()
733+
723734
724735def unshear_44 (affine ):
725736 RZS = affine [:3 , :3 ]
@@ -766,19 +777,6 @@ class TestNifti1Pair(tana.TestAnalyzeImage, tspm.ImageScalingMixin):
766777 image_class = Nifti1Pair
767778 supported_np_types = TestNifti1PairHeader .supported_np_types
768779
769- def setUp (self ):
770- # Add warning filters for duration of test case
771- self ._wctx = warnings .catch_warnings ()
772- self ._wctx .__enter__ ()
773- warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
774- warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
775- warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
776- UserWarning )
777-
778- def tearDown (self ):
779- # Restore warning filters
780- self ._wctx .__exit__ ()
781-
782780 def test_none_qsform (self ):
783781 # Check that affine gets set to q/sform if header is None
784782 img_klass = self .image_class
@@ -1222,6 +1220,14 @@ def test_zooms_edge_cases(self):
12221220 assert_raises (ValueError , img .header .set_zooms , (3 , 3 , 3 , 3.5 ),
12231221 units = 'badparam' )
12241222
1223+ def test_no_finite_values (self ):
1224+ with clear_and_catch_warnings () as warns :
1225+ warnings .filterwarnings ('ignore' , 'get_zooms' , FutureWarning )
1226+ warnings .filterwarnings ('ignore' , 'set_zooms' , FutureWarning )
1227+ warnings .filterwarnings ('ignore' , 'Unknown (spatial|time) units' ,
1228+ UserWarning )
1229+ super (TestNifti1Pair , self ).test_no_finite_values ()
1230+
12251231
12261232class TestNifti1Image (TestNifti1Pair ):
12271233 # Run analyze-flavor spatialimage tests
0 commit comments