File tree Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ Feature : Header properties
2+ In order to interact with document headers
3+ As a developer using python-docx
4+ I need read/write properties on the Header object
5+
6+
7+ @wip
8+ Scenario Outline : Get Header.is_linked_to_previous
9+ Given a header <having-or-no> definition
10+ Then header.is_linked_to_previous is <value>
11+
12+ Examples : Header.is_linked_to_previous states
13+ | having -or -no | value |
14+ | having a | False |
15+ | 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 __future__ import (
8+ absolute_import , division , print_function , unicode_literals
9+ )
10+
11+ from behave import given , then
12+
13+ from docx import Document
14+
15+ from helpers import test_docx
16+
17+
18+ # given ===================================================
19+
20+ @given ('a header {having_or_no} definition' )
21+ def given_a_header_having_or_no_definition (context , having_or_no ):
22+ filename = {
23+ 'having a' : 'hdr-header-props' ,
24+ 'having no' : 'doc-default' ,
25+ }[having_or_no ]
26+ document = Document (test_docx (filename ))
27+ context .header = document .sections [0 ].header
28+
29+
30+ # then =====================================================
31+
32+ @then (u'header.is_linked_to_previous is {value}' )
33+ def then_header_is_linked_to_previous_is_value (context , value ):
34+ expected_value = {'True' : True , 'False' : False }[value ]
35+ header = context .header
36+ assert header .is_linked_to_previous is expected_value
You can’t perform that action at this time.
0 commit comments