MCPcopy
hub / github.com/python-openxml/python-docx / it_can_add_a_section

Method it_can_add_a_section

tests/test_document.py:138–160  ·  view source on GitHub ↗
(
        self,
        sentinel_cxml: str,
        start_type: WD_SECTION,
        new_sentinel_cxml: str,
        Section_: Mock,
        section_: Mock,
        document_part_: Mock,
    )

Source from the content-addressed store, hash-verified

136 ],
137 )
138 def it_can_add_a_section(
139 self,
140 sentinel_cxml: str,
141 start_type: WD_SECTION,
142 new_sentinel_cxml: str,
143 Section_: Mock,
144 section_: Mock,
145 document_part_: Mock,
146 ):
147 Section_.return_value = section_
148 document = Document(
149 cast(CT_Document, element("w:document/w:body/(w:p,%s)" % sentinel_cxml)),
150 document_part_,
151 )
152
153 section = document.add_section(start_type)
154
155 assert document.element.xml == xml(
156 "w:document/w:body/(w:p,w:p/w:pPr/%s,%s)" % (sentinel_cxml, new_sentinel_cxml)
157 )
158 sectPr = document.element.xpath("w:body/w:sectPr")[0]
159 Section_.assert_called_once_with(sectPr, document_part_)
160 assert section is section_
161
162 def it_can_add_a_table(
163 self,

Callers

nothing calls this directly

Calls 5

add_sectionMethod · 0.95
DocumentClass · 0.90
elementFunction · 0.85
xmlFunction · 0.85
xpathMethod · 0.80

Tested by

no test coverage detected