|
8 | 8 |
|
9 | 9 | from docx.enum.section import WD_ORIENT, WD_SECTION |
10 | 10 | from docx.parts.document import DocumentPart |
11 | | -from docx.section import Section, Sections |
| 11 | +from docx.section import _Footer, Section, Sections |
12 | 12 | from docx.shared import Inches |
13 | 13 |
|
14 | 14 | from .unitutil.cxml import element, xml |
@@ -91,6 +91,18 @@ def section_(self, request): |
91 | 91 |
|
92 | 92 | class DescribeSection(object): |
93 | 93 |
|
| 94 | + def it_provides_access_to_its_default_footer( |
| 95 | + self, document_part_, _Footer_, footer_ |
| 96 | + ): |
| 97 | + sectPr = element('w:sectPr') |
| 98 | + _Footer_.return_value = footer_ |
| 99 | + section = Section(sectPr, document_part_) |
| 100 | + |
| 101 | + footer = section.footer |
| 102 | + |
| 103 | + _Footer_.assert_called_once_with(sectPr, document_part_) |
| 104 | + assert footer is footer_ |
| 105 | + |
94 | 106 | def it_knows_its_start_type(self, start_type_get_fixture): |
95 | 107 | sectPr, expected_start_type = start_type_get_fixture |
96 | 108 | section = Section(sectPr, None) |
@@ -309,3 +321,17 @@ def start_type_set_fixture(self, request): |
309 | 321 | sectPr = element(initial_cxml) |
310 | 322 | expected_xml = xml(expected_cxml) |
311 | 323 | return sectPr, new_start_type, expected_xml |
| 324 | + |
| 325 | + # fixture components --------------------------------------------- |
| 326 | + |
| 327 | + @pytest.fixture |
| 328 | + def document_part_(self, request): |
| 329 | + return instance_mock(request, DocumentPart) |
| 330 | + |
| 331 | + @pytest.fixture |
| 332 | + def _Footer_(self, request): |
| 333 | + return class_mock(request, "docx.section._Footer") |
| 334 | + |
| 335 | + @pytest.fixture |
| 336 | + def footer_(self, request): |
| 337 | + return instance_mock(request, _Footer) |
0 commit comments