|
13 | 13 | from docx import Document
|
14 | 14 | from docx.enum.text import WD_ALIGN_PARAGRAPH, WD_LINE_SPACING
|
15 | 15 | from docx.shared import Pt
|
| 16 | +from docx.oxml.text.parfmt import CT_TabStops |
16 | 17 |
|
17 | 18 | from helpers import test_docx
|
18 | 19 |
|
19 | 20 |
|
20 | 21 | # given ===================================================
|
21 | 22 |
|
| 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 | + |
22 | 33 | @given('a paragraph format having {prop_name} set {setting}')
|
23 | 34 | def given_a_paragraph_format_having_prop_set(context, prop_name, setting):
|
24 | 35 | style_name = {
|
@@ -139,6 +150,14 @@ def when_I_assign_value_to_paragraph_format_prop(context, value, prop_name):
|
139 | 150 |
|
140 | 151 | # then =====================================================
|
141 | 152 |
|
| 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 | + |
142 | 161 | @then('paragraph_format.alignment is {value}')
|
143 | 162 | def then_paragraph_format_alignment_is_value(context, value):
|
144 | 163 | expected_value = {
|
|
0 commit comments