def it_loads_default_header_XML_from_a_template_to_help(self): # ---tests integration with OS--- xml_bytes = HeaderPart._default_header_xml() assert xml_bytes.startswith( b"<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\n<w:hdr\n" ) assert len(xml_bytes) == 1395
def it_can_create_a_new_header_part(self, package_, _default_header_xml_, parse_xml_, _init_): hdr = element("w:hdr") package_.next_partname.return_value = "/word/header42.xml" _default_header_xml_.return_value = "<w:hdr>" parse_xml_.return_value = hdr header_part = HeaderPart.new(package_) package_.next_partname.assert_called_once_with("/word/header%d.xml") _default_header_xml_.assert_called_once_with() parse_xml_.assert_called_once_with("<w:hdr>") _init_.assert_called_once_with(header_part, "/word/header42.xml", CT.WML_HEADER, hdr, package_)
def it_can_create_a_new_header_part( self, package_, _default_header_xml_, parse_xml_, _init_ ): hdr = element("w:hdr") package_.next_partname.return_value = "/word/header42.xml" _default_header_xml_.return_value = "<w:hdr>" parse_xml_.return_value = hdr header_part = HeaderPart.new(package_) package_.next_partname.assert_called_once_with("/word/header%d.xml") _default_header_xml_.assert_called_once_with() parse_xml_.assert_called_once_with("<w:hdr>") _init_.assert_called_once_with( header_part, "/word/header42.xml", CT.WML_HEADER, hdr, package_ )
def add_header_part(self): """Return (header_part, rId) pair for newly-created header part.""" header_part = HeaderPart.new(self.package) rId = self.relate_to(header_part, RT.HEADER) return header_part, rId