@@ -46,11 +46,15 @@ def when_add_page_break_to_document(context):
4646 document .add_page_break ()
4747
4848
49- @when ('I add a paragraph specifying its style' )
50- def when_add_paragraph_specifying_style (context ):
49+ @when ('I add a paragraph specifying its style as a {kind} ' )
50+ def when_I_add_a_paragraph_specifying_its_style_as_a (context , kind ):
5151 document = context .document
52- context .paragraph_style = 'barfoo'
53- document .add_paragraph (style = context .paragraph_style )
52+ style = context .style = document .styles ['Heading 1' ]
53+ style_spec = {
54+ 'style object' : style ,
55+ 'style name' : 'Heading 1' ,
56+ }[kind ]
57+ document .add_paragraph (style = style_spec )
5458
5559
5660@when ('I add a paragraph specifying its text' )
@@ -135,11 +139,10 @@ def then_last_p_contains_specified_text(context):
135139
136140
137141@then ('the last paragraph has the style I specified' )
138- def then_last_p_has_specified_style (context ):
139- document = context .document
140- style = context .paragraph_style
141- p = document .paragraphs [- 1 ]
142- assert p .style == style
142+ def then_the_last_paragraph_has_the_style_I_specified (context ):
143+ document , expected_style = context .document , context .style
144+ paragraph = document .paragraphs [- 1 ]
145+ assert paragraph .style == expected_style
143146
144147
145148@then ('the last paragraph is the empty paragraph I added' )
0 commit comments