Skip to content

Commit e375ccc

Browse files
committed
acpt: add scenarios for feature/tabstops
1 parent d33255c commit e375ccc

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

features/steps/parfmt.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,23 @@
1313
from docx import Document
1414
from docx.enum.text import WD_ALIGN_PARAGRAPH, WD_LINE_SPACING
1515
from docx.shared import Pt
16+
from docx.oxml.text.parfmt import CT_TabStops
1617

1718
from helpers import test_docx
1819

1920

2021
# given ===================================================
2122

23+
@given('a paragraph having {value} TabStop elements')
24+
def given_a_paragraph_having_value_tabstop_elements(context, value):
25+
tabstop_idx = {
26+
'no': 0,
27+
'some': 1
28+
}[value]
29+
document = Document(test_docx('tab-stops'))
30+
context.paragraph = document.paragraphs[tabstop_idx]
31+
32+
2233
@given('a paragraph format having {prop_name} set {setting}')
2334
def given_a_paragraph_format_having_prop_set(context, prop_name, setting):
2435
style_name = {
@@ -139,6 +150,14 @@ def when_I_assign_value_to_paragraph_format_prop(context, value, prop_name):
139150

140151
# then =====================================================
141152

153+
@then('paragraph_format.tab_stops is its TabStops object')
154+
def then_paragraph_format_tab_stops_is_its_tabstops_object(context):
155+
paragraph = context.paragraph
156+
paragraph_format = paragraph.paragraph_format
157+
tab_stops = paragraph_format.tab_stops
158+
assert isinstance(tab_stops, CT_TabStops)
159+
160+
142161
@then('paragraph_format.alignment is {value}')
143162
def then_paragraph_format_alignment_is_value(context, value):
144163
expected_value = {
12.5 KB
Binary file not shown.

features/txt-parfmt-props.feature

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ Feature: Get or set paragraph formatting properties
44
I need a ParagraphFormat object with read/write formatting properties
55

66

7+
@wip
8+
Scenario Outline: Get tab stops object
9+
Given a paragraph having <value> TabStop elements
10+
Then paragraph_format.tab_stops is its TabStops object
11+
12+
Examples: values for TabStop elements
13+
| value |
14+
| no |
15+
| some |
16+
17+
718
Scenario Outline: Get paragraph alignment
819
Given a paragraph format having <align-type> alignment
920
Then paragraph_format.alignment is <value>

0 commit comments

Comments
 (0)