Skip to content

Commit bf21050

Browse files
author
Steve Canny
committed
acpt: add sty-get-styles-part.feature
1 parent a27d14c commit bf21050

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

features/num-get-numbering-part.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Feature: Get the document numbering part
2-
In order query and modify numbering settings
2+
In order to query and modify numbering settings
33
As a programmer using the advanced python-docx API
44
I need access to the numbering part of the document
55

features/steps/styles.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# encoding: utf-8
2+
3+
"""
4+
Step implementations for styles-related features
5+
"""
6+
7+
from behave import given, then, when
8+
9+
from docx import Document
10+
11+
from helpers import test_docx
12+
13+
14+
# given ===================================================
15+
16+
@given('a document having a styles part')
17+
def given_a_document_having_a_styles_part(context):
18+
docx_path = test_docx('sty-having-styles-part')
19+
context.document = Document(docx_path)
20+
21+
22+
# when ====================================================
23+
24+
@when('I get the styles part from the document')
25+
def when_get_styles_part_from_document(context):
26+
document = context.document
27+
context.styles_part = document.styles_part
28+
29+
30+
# then =====================================================
31+
32+
@then('the styles part has the expected number of style definitions')
33+
def then_styles_part_has_expected_number_of_style_definitions(context):
34+
styles_part = context.styles_part
35+
assert len(styles_part.styles) == 4
20.9 KB
Binary file not shown.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Feature: Get the document styles part
2+
In order to query and modify styles
3+
As a programmer using the advanced python-docx API
4+
I need access to the styles part of the document
5+
6+
@wip
7+
Scenario: Get an existing styles part from document
8+
Given a document having a styles part
9+
When I get the styles part from the document
10+
Then the styles part has the expected number of style definitions

0 commit comments

Comments
 (0)