Skip to content

Commit c9a99c5

Browse files
committed
acpt: add scenario for header.is_linked_to_previous
1 parent 334af24 commit c9a99c5

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

features/hdr-header-props.feature

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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 |

features/steps/header.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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
12.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)