@@ -64,6 +64,10 @@ def it_knows_the_image_dimensions(self, dimensions_fixture):
6464 assert image .px_width == px_width
6565 assert image .px_height == px_height
6666
67+ def it_knows_the_image_filename_extension (self ):
68+ image = Image (None , 'foobar.png' , None )
69+ assert image .ext == 'png'
70+
6771 def it_knows_the_horz_and_vert_dpi_of_the_image (self , dpi_fixture ):
6872 image_header_ , horz_dpi , vert_dpi = dpi_fixture
6973 image = Image (None , None , image_header_ )
@@ -240,13 +244,13 @@ def it_can_construct_from_an_image_stream(self):
240244 def it_knows_the_extension_of_a_file_based_image (self ):
241245 image_file_path = test_file ('monty-truth.png' )
242246 image = Image_OLD .from_file (image_file_path )
243- assert image .ext == '. png'
247+ assert image .ext == 'png'
244248
245249 def it_knows_the_extension_of_a_stream_based_image (self ):
246250 image_file_path = test_file ('monty-truth.png' )
247251 with open (image_file_path , 'rb' ) as image_file_stream :
248252 image = Image_OLD .from_file (image_file_stream )
249- assert image .ext == '. png'
253+ assert image .ext == 'png'
250254
251255 def it_correctly_characterizes_a_few_known_images (
252256 self , known_image_fixture ):
@@ -268,16 +272,16 @@ def it_correctly_characterizes_a_few_known_images(
268272 @pytest .fixture (params = [0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ])
269273 def known_image_fixture (self , request ):
270274 cases = (
271- ('python.bmp' , ('. bmp' , CT .BMP , 211 , 71 , 72 , 72 )),
272- ('sonic.gif' , ('. gif' , CT .GIF , 290 , 360 , 72 , 72 )),
273- ('python-icon.jpeg' , ('. jpg' , CT .JPEG , 204 , 204 , 72 , 72 )),
274- ('300-dpi.jpg' , ('. jpg' , CT .JPEG , 1504 , 1936 , 300 , 300 )),
275- ('monty-truth.png' , ('. png' , CT .PNG , 150 , 214 , 72 , 72 )),
276- ('150-dpi.png' , ('. png' , CT .PNG , 901 , 1350 , 150 , 150 )),
277- ('300-dpi.png' , ('. png' , CT .PNG , 860 , 579 , 300 , 300 )),
278- ('72-dpi.tiff' , ('. tiff' , CT .TIFF , 48 , 48 , 72 , 72 )),
279- ('300-dpi.TIF' , ('. tiff' , CT .TIFF , 2464 , 3248 , 300 , 300 )),
280- ('CVS_LOGO.WMF' , ('. wmf' , CT .X_WMF , 149 , 59 , 72 , 72 )),
275+ ('python.bmp' , ('bmp' , CT .BMP , 211 , 71 , 72 , 72 )),
276+ ('sonic.gif' , ('gif' , CT .GIF , 290 , 360 , 72 , 72 )),
277+ ('python-icon.jpeg' , ('jpg' , CT .JPEG , 204 , 204 , 72 , 72 )),
278+ ('300-dpi.jpg' , ('jpg' , CT .JPEG , 1504 , 1936 , 300 , 300 )),
279+ ('monty-truth.png' , ('png' , CT .PNG , 150 , 214 , 72 , 72 )),
280+ ('150-dpi.png' , ('png' , CT .PNG , 901 , 1350 , 150 , 150 )),
281+ ('300-dpi.png' , ('png' , CT .PNG , 860 , 579 , 300 , 300 )),
282+ ('72-dpi.tiff' , ('tiff' , CT .TIFF , 48 , 48 , 72 , 72 )),
283+ ('300-dpi.TIF' , ('tiff' , CT .TIFF , 2464 , 3248 , 300 , 300 )),
284+ ('CVS_LOGO.WMF' , ('wmf' , CT .X_WMF , 149 , 59 , 72 , 72 )),
281285 )
282286 image_filename , characteristics = cases [request .param ]
283287 return image_filename , characteristics
0 commit comments