@@ -66,22 +66,14 @@ def it_should_raise_on_heading_level_out_of_range(self, document):
6666 with pytest .raises (ValueError ):
6767 document .add_heading (level = 10 )
6868
69- def it_can_add_an_empty_paragraph (self , add_empty_paragraph_fixture ):
70- document , document_part_ , paragraph_ = add_empty_paragraph_fixture
71- paragraph = document .add_paragraph ()
72- document_part_ .add_paragraph .assert_called_once_with ()
69+ def it_can_add_a_paragraph (self , add_paragraph_fixture ):
70+ document , document_part_ , text , style , paragraph_ = (
71+ add_paragraph_fixture
72+ )
73+ paragraph = document .add_paragraph (text , style )
74+ document_part_ .add_paragraph .assert_called_once_with (text , style )
7375 assert paragraph is paragraph_
7476
75- def it_can_add_a_paragraph_of_text (self , add_text_paragraph_fixture ):
76- document , text = add_text_paragraph_fixture
77- paragraph = document .add_paragraph (text )
78- paragraph .add_run .assert_called_once_with (text )
79-
80- def it_can_add_a_styled_paragraph (self , add_styled_paragraph_fixture ):
81- document , style = add_styled_paragraph_fixture
82- paragraph = document .add_paragraph (style = style )
83- assert paragraph .style == style
84-
8577 def it_can_add_a_page_break (self , add_page_break_fixture ):
8678 document , document_part_ , paragraph_ , run_ = add_page_break_fixture
8779 paragraph = document .add_page_break ()
@@ -177,10 +169,15 @@ def it_creates_styles_part_on_first_access_if_not_present(
177169
178170 # fixtures -------------------------------------------------------
179171
180- @pytest .fixture
181- def add_empty_paragraph_fixture (
182- self , document , document_part_ , paragraph_ ):
183- return document , document_part_ , paragraph_
172+ @pytest .fixture (params = [
173+ ('' , None ),
174+ ('' , 'Heading1' ),
175+ ('foo\r bar' , 'BodyText' ),
176+ ])
177+ def add_paragraph_fixture (
178+ self , request , document , document_part_ , paragraph_ ):
179+ text , style = request .param
180+ return document , document_part_ , text , style , paragraph_
184181
185182 @pytest .fixture (params = [0 , 1 , 2 , 5 , 9 ])
186183 def add_heading_fixture (
@@ -208,11 +205,6 @@ def add_picture_fixture(self, request, run_, picture_):
208205 def add_section_fixture (self , document , start_type_ , section_ ):
209206 return document , start_type_ , section_
210207
211- @pytest .fixture
212- def add_styled_paragraph_fixture (self , document ):
213- style = 'foobaresque'
214- return document , style
215-
216208 @pytest .fixture (params = [None , 'LightShading-Accent1' , 'foobar' ])
217209 def add_table_fixture (self , request , document , document_part_ , table_ ):
218210 rows , cols = 4 , 2
@@ -222,11 +214,6 @@ def add_table_fixture(self, request, document, document_part_, table_):
222214 table_
223215 )
224216
225- @pytest .fixture
226- def add_text_paragraph_fixture (self , document ):
227- text = 'foobar\r barfoo'
228- return document , text
229-
230217 @pytest .fixture
231218 def init_fixture (self , docx_ , open_ ):
232219 return docx_ , open_
0 commit comments