@@ -117,25 +117,6 @@ def validate_header_deprecated(self, imaker, params):
117117 assert_equal (len (w ), 1 )
118118 assert_true (hdr is img .header )
119119
120- def validate_shape (self , imaker , params ):
121- # Validate shape
122- img = imaker ()
123- # Same as expected shape
124- assert_equal (img .shape , params ['shape' ])
125- # Same as array shape if passed
126- if 'data' in params :
127- assert_equal (img .shape , params ['data' ].shape )
128- # Read only
129- assert_raises (AttributeError , setattr , img , 'shape' , np .eye (4 ))
130-
131- def validate_shape_deprecated (self , imaker , params ):
132- # Check deprecated get_shape API
133- with clear_and_catch_warnings () as w :
134- warnings .simplefilter ('always' , DeprecationWarning )
135- img = imaker ()
136- assert_equal (img .get_shape (), params ['shape' ])
137- assert_equal (len (w ), 1 )
138-
139120 def validate_filenames (self , imaker , params ):
140121 # Validate the filename, file_map interface
141122 if not self .can_save :
@@ -289,6 +270,26 @@ def validate_data_deprecated(self, imaker, params):
289270 fake_data = np .zeros (img .shape ).astype (img .get_data_dtype ())
290271 assert_raises (AttributeError , setattr , img , '_data' , fake_data )
291272
273+ def validate_shape (self , imaker , params ):
274+ # Validate shape
275+ img = imaker ()
276+ # Same as expected shape
277+ assert_equal (img .shape , params ['shape' ])
278+ # Same as array shape if passed
279+ if 'data' in params :
280+ assert_equal (img .shape , params ['data' ].shape )
281+ # Read only
282+ assert_raises (AttributeError , setattr , img , 'shape' , np .eye (4 ))
283+
284+ def validate_shape_deprecated (self , imaker , params ):
285+ # Check deprecated get_shape API
286+ with clear_and_catch_warnings () as w :
287+ warnings .simplefilter ('always' , DeprecationWarning )
288+ img = imaker ()
289+ assert_equal (img .get_shape (), params ['shape' ])
290+ assert_equal (len (w ), 1 )
291+
292+
292293
293294class HeaderShapeMixin (object ):
294295 """ Tests that header shape can be set and got
0 commit comments