@@ -276,11 +276,10 @@ def it_matches_an_override_on_case_insensitive_partname(
276276 ct_map , partname , content_type = match_override_fixture
277277 assert ct_map [partname ] == content_type
278278
279- def it_falls_back_to_defaults (self ):
280- ct_map = _ContentTypeMap ()
281- ct_map ._overrides = {PackURI ('/part/name1.xml' ): 'app/vnd.type1' }
282- ct_map ._defaults = {'.xml' : 'application/xml' }
283- assert ct_map [PackURI ('/part/name2.xml' )] == 'application/xml'
279+ def it_falls_back_to_case_insensitive_extension_default_match (
280+ self , match_default_fixture ):
281+ ct_map , partname , content_type = match_default_fixture
282+ assert ct_map [partname ] == content_type
284283
285284 def it_should_raise_on_partname_not_found (self ):
286285 ct_map = _ContentTypeMap ()
@@ -299,7 +298,7 @@ def it_should_raise_on_key_not_instance_of_PackURI(self):
299298 def from_xml_fixture (self ):
300299 entries = (
301300 ('Default' , 'xml' , CT .XML ),
302- # ('Default', 'PNG', CT.PNG),
301+ ('Default' , 'PNG' , CT .PNG ),
303302 ('Override' , '/ppt/presentation.xml' , CT .PML_PRESENTATION_MAIN ),
304303 )
305304 content_types_xml = self ._xml_from (entries )
@@ -315,6 +314,19 @@ def from_xml_fixture(self):
315314 expected_overrides [partname ] = content_type
316315 return content_types_xml , expected_defaults , expected_overrides
317316
317+ @pytest .fixture (params = [
318+ ('/foo/bar.xml' , 'xml' , 'application/xml' ),
319+ ('/foo/bar.PNG' , 'png' , 'image/png' ),
320+ ('/foo/bar.jpg' , 'JPG' , 'image/jpeg' ),
321+ ])
322+ def match_default_fixture (self , request ):
323+ partname_str , ext , content_type = request .param
324+ partname = PackURI (partname_str )
325+ ct_map = _ContentTypeMap ()
326+ ct_map ._add_override (PackURI ('/bar/foo.xyz' ), 'application/xyz' )
327+ ct_map ._add_default (ext , content_type )
328+ return ct_map , partname , content_type
329+
318330 @pytest .fixture (params = [
319331 ('/foo/bar.xml' , '/foo/bar.xml' ),
320332 ('/foo/bar.xml' , '/FOO/Bar.XML' ),
0 commit comments