コード例 #1
0
ファイル: test_oxml.py プロジェクト: scanny/python-pptx
 def it_can_build_types_element_incrementally(self):
     types = CT_Types.new()
     types.add_default("xml", "application/xml")
     types.add_default("jpeg", "image/jpeg")
     types.add_override("/docProps/core.xml", "app/vnd.type1")
     types.add_override("/ppt/presentation.xml", "app/vnd.type2")
     types.add_override("/docProps/thumbnail.jpeg", "image/jpeg")
     expected_types_xml = a_Types().xml
     assert types.xml == expected_types_xml
コード例 #2
0
ファイル: test_oxml.py プロジェクト: scanny/python-pptx
 def it_can_build_types_element_incrementally(self):
     types = CT_Types.new()
     types.add_default("xml", "application/xml")
     types.add_default("jpeg", "image/jpeg")
     types.add_override("/docProps/core.xml", "app/vnd.type1")
     types.add_override("/ppt/presentation.xml", "app/vnd.type2")
     types.add_override("/docProps/thumbnail.jpeg", "image/jpeg")
     expected_types_xml = a_Types().xml
     assert types.xml == expected_types_xml
コード例 #3
0
 def it_can_build_types_element_incrementally(self):
     types = CT_Types.new()
     types.add_default('xml', 'application/xml')
     types.add_default('jpeg', 'image/jpeg')
     types.add_override('/docProps/core.xml', 'app/vnd.type1')
     types.add_override('/ppt/presentation.xml', 'app/vnd.type2')
     types.add_override('/docProps/thumbnail.jpeg', 'image/jpeg')
     expected_types_xml = a_Types().xml
     assert types.xml == expected_types_xml
コード例 #4
0
ファイル: test_oxml.py プロジェクト: castaway/python-pptx
 def it_can_build_types_element_incrementally(self):
     types = CT_Types.new()
     types.add_default('.xml', 'application/xml')
     types.add_default('.jpeg', 'image/jpeg')
     types.add_override('/docProps/core.xml', 'app/vnd.type1')
     types.add_override('/ppt/presentation.xml', 'app/vnd.type2')
     types.add_override('/docProps/thumbnail.jpeg', 'image/jpeg')
     expected_types_xml = a_Types().xml
     assert types.xml == expected_types_xml
コード例 #5
0
    def _xml(self):
        """lxml.etree._Element containing the content-types item.

        This XML object is suitable for serialization to the `[Content_Types].xml` item
        for an OPC package. Although the sequence of elements is not strictly
        significant, as an aid to testing and readability Default elements are sorted by
        extension and Override elements are sorted by partname.
        """
        defaults, overrides = self._defaults_and_overrides
        _types_elm = CT_Types.new()

        for ext, content_type in sorted(defaults.items()):
            _types_elm.add_default(ext, content_type)
        for partname, content_type in sorted(overrides.items()):
            _types_elm.add_override(partname, content_type)

        return _types_elm
コード例 #6
0
ファイル: test_oxml.py プロジェクト: scanny/python-pptx
 def it_can_construct_a_new_types_element(self):
     types = CT_Types.new()
     expected_xml = a_Types().empty().xml
     assert types.xml == expected_xml
コード例 #7
0
ファイル: test_oxml.py プロジェクト: scanny/python-pptx
 def it_can_construct_a_new_types_element(self):
     types = CT_Types.new()
     expected_xml = a_Types().empty().xml
     assert types.xml == expected_xml