Skip to content

Commit c4c978a

Browse files
author
Steve Canny
committed
acpt: add scenario for _Style.type
1 parent fbc93af commit c4c978a

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

features/steps/styles.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from behave import given, then, when
88

99
from docx import Document
10+
from docx.enum.style import WD_STYLE_TYPE
1011
from docx.styles.styles import Styles
1112
from docx.styles.style import BaseStyle
1213

@@ -34,6 +35,13 @@ def given_a_style_having_a_known_style_id(context):
3435
context.style = document.styles['Normal']
3536

3637

38+
@given('a style having a known type')
39+
def given_a_style_having_a_known_type(context):
40+
docx_path = test_docx('sty-having-styles-part')
41+
document = Document(docx_path)
42+
context.style = document.styles['Normal']
43+
44+
3745
# when =====================================================
3846

3947
@when('I assign a new value to style.style_id')
@@ -84,3 +92,9 @@ def then_style_style_id_is_the_which_style_id(context, which):
8492
}[which]
8593
style = context.style
8694
assert style.style_id == expected_style_id
95+
96+
97+
@then('style.type is the known type')
98+
def then_style_type_is_the_known_type(context):
99+
style = context.style
100+
assert style.type == WD_STYLE_TYPE.PARAGRAPH

features/sty-style-props.feature

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ Feature: Get and set style properties
1313
Given a style having a known style id
1414
When I assign a new value to style.style_id
1515
Then style.style_id is the new style id
16+
17+
18+
@wip
19+
Scenario: Get style type
20+
Given a style having a known type
21+
Then style.type is the known type

0 commit comments

Comments
 (0)