File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Feature : Read and write core header properties
2+ In order to interact with document headers
3+ As a developer using python-docx
4+ I need to access and modify the header object
5+
6+ @wip
7+ Scenario Outline : Get Header.is_linked_to_previous
8+ Given a header <having-or-no> definition
9+ Then header.is_linked_to_previous is <value>
10+
11+ Examples : ...
12+ | having -or -no | value |
13+ | having a | False |
14+ | having no | True |
Original file line number Diff line number Diff line change 1+ # encoding: utf-8
2+
3+ """
4+ Step implementations for header-related features
5+ """
6+
7+ from behave import given , then
8+
9+ from docx import Document
10+
11+ from helpers import test_docx
12+
13+
14+ # given ===================================================
15+
16+ @given (u'a header having a definition' )
17+ def given_a_header_having_a_definition (context ):
18+ document = Document (test_docx ('doc-default' ))
19+ context .header = document .sections [0 ].header
20+
21+
22+ @given (u'a header having no definition' )
23+ def given_a_header_having_no_definition (context ):
24+ document = Document (test_docx ('hdr-header-props' ))
25+ context .header = document .sections [0 ].header
26+
27+
28+ # then =====================================================
29+
30+ @then (u'header.is_linked_to_previous is False' )
31+ def then_header_is_linked_to_previous_is_False (context ):
32+ header = context .header
33+ assert header .is_linked_to_previous is False
34+
35+
36+ @then (u'header.is_linked_to_previous is True' )
37+ def then_header_is_linked_to_previous_is_True (context ):
38+ header = context .header
39+ assert header .is_linked_to_previous is True
You can’t perform that action at this time.
0 commit comments