Skip to content

Commit b14766c

Browse files
eupharisSteve Canny
authored andcommitted
acpt: scenarios for Header.is_linked_to_previous
1 parent 04fd31e commit b14766c

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

features/hdr-header-props.feature

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

features/steps/header.py

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

0 commit comments

Comments
 (0)