|
9 | 9 | from docx.enum.section import WD_ORIENT, WD_SECTION |
10 | 10 | from docx.parts.document import DocumentPart |
11 | 11 | from docx.parts.hdrftr import HeaderPart |
12 | | -from docx.section import _Footer, _Header, Section, Sections |
| 12 | +from docx.section import _BaseHeaderFooter, _Footer, _Header, Section, Sections |
13 | 13 | from docx.shared import Inches |
14 | 14 |
|
15 | 15 | from .unitutil.cxml import element, xml |
@@ -358,6 +358,33 @@ def header_(self, request): |
358 | 358 | return instance_mock(request, _Header) |
359 | 359 |
|
360 | 360 |
|
| 361 | +class Describe_BaseHeaderFooter(object): |
| 362 | + |
| 363 | + def it_knows_when_its_linked_to_the_previous_header( |
| 364 | + self, is_linked_get_fixture, _has_definition_prop_ |
| 365 | + ): |
| 366 | + has_definition, expected_value = is_linked_get_fixture |
| 367 | + _has_definition_prop_.return_value = has_definition |
| 368 | + header = _BaseHeaderFooter(None, None) |
| 369 | + |
| 370 | + is_linked = header.is_linked_to_previous |
| 371 | + |
| 372 | + assert is_linked is expected_value |
| 373 | + |
| 374 | + # fixtures ------------------------------------------------------- |
| 375 | + |
| 376 | + @pytest.fixture(params=[(False, True), (True, False)]) |
| 377 | + def is_linked_get_fixture(self, request): |
| 378 | + has_definition, expected_value = request.param |
| 379 | + return has_definition, expected_value |
| 380 | + |
| 381 | + # fixture components --------------------------------------------- |
| 382 | + |
| 383 | + @pytest.fixture |
| 384 | + def _has_definition_prop_(self, request): |
| 385 | + return property_mock(request, _BaseHeaderFooter, "_has_definition") |
| 386 | + |
| 387 | + |
361 | 388 | class Describe_Header(object): |
362 | 389 |
|
363 | 390 | def it_knows_when_its_linked_to_the_previous_header( |
|
0 commit comments