File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ Feature : Replace paragraph text
2+ In order to conveniently change the text of a paragraph in place
3+ As a developer using python-docx
4+ I need a writable text property on paragraph
5+
6+
7+ @wip
8+ Scenario : Set paragraph text
9+ Given a paragraph with content and formatting
10+ When I set the paragraph text
11+ Then the paragraph has the text I set
12+ And the paragraph formatting is preserved
Original file line number Diff line number Diff line change @@ -67,6 +67,11 @@ def when_I_set_the_paragraph_style(context):
6767 context .paragraph .style = TEST_STYLE
6868
6969
70+ @when ('I set the paragraph text' )
71+ def when_I_set_the_paragraph_text (context ):
72+ context .paragraph .text = 'bar\t foo\r '
73+
74+
7075# then =====================================================
7176
7277@then ('the document contains four paragraphs' )
@@ -99,6 +104,11 @@ def then_the_paragraph_has_the_style_I_set(context):
99104 assert paragraph .style == TEST_STYLE
100105
101106
107+ @then ('the paragraph has the text I set' )
108+ def then_the_paragraph_has_the_text_I_set (context ):
109+ assert context .paragraph .text == 'bar\t foo\n '
110+
111+
102112@then ('the style of the second paragraph matches the style I set' )
103113def then_the_style_of_the_second_paragraph_matches_the_style_I_set (context ):
104114 second_paragraph = context .document .paragraphs [1 ]
You can’t perform that action at this time.
0 commit comments