Skip to content

Commit 3b0253b

Browse files
author
Steve Canny
committed
acpt: add scenario for Paragraph.paragraph_format
1 parent 4564b33 commit 3b0253b

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

features/par-access-parfmt.feature

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Feature: Access paragraph format
2+
In order to get or change the formatting of a paragraph
3+
As a developer using python-docx
4+
I need access to the paragraph format of a paragraph
5+
6+
7+
@wip
8+
Scenario: Get paragraph format object
9+
Given a paragraph
10+
Then paragraph.paragraph_format is its ParagraphFormat object

features/steps/paragraph.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from docx import Document
1010
from docx.enum.text import WD_ALIGN_PARAGRAPH
11+
from docx.text.paragraph import ParagraphFormat
1112

1213
from helpers import saved_docx_path, test_docx, test_text
1314

@@ -90,6 +91,14 @@ def when_I_set_the_paragraph_text(context):
9091

9192
# then =====================================================
9293

94+
@then('paragraph.paragraph_format is its ParagraphFormat object')
95+
def then_paragraph_paragraph_format_is_its_parfmt_object(context):
96+
paragraph = context.paragraph
97+
paragraph_format = paragraph.paragraph_format
98+
assert isinstance(paragraph_format, ParagraphFormat)
99+
assert paragraph_format.element is paragraph.element
100+
101+
93102
@then('paragraph.style is {value_key}')
94103
def then_paragraph_style_is_value(context, value_key):
95104
styles = context.document.styles

0 commit comments

Comments
 (0)