@@ -55,11 +55,9 @@ def it_should_raise_if_not_a_Word_file(self, Package_, package_, docx_):
5555 Document ._open (docx_ )
5656
5757 def it_can_add_a_heading (self , add_heading_fixture ):
58- document , add_paragraph_ , paragraph_ , text , level , style = (
59- add_heading_fixture
60- )
58+ document , text , level , style , paragraph_ = add_heading_fixture
6159 paragraph = document .add_heading (text , level )
62- add_paragraph_ .assert_called_once_with (text , style )
60+ document . add_paragraph .assert_called_once_with (text , style )
6361 assert paragraph is paragraph_
6462
6563 def it_should_raise_on_heading_level_out_of_range (self , document ):
@@ -69,11 +67,11 @@ def it_should_raise_on_heading_level_out_of_range(self, document):
6967 document .add_heading (level = 10 )
7068
7169 def it_can_add_a_paragraph (self , add_paragraph_fixture ):
72- document , document_part_ , text , style , paragraph_ = (
73- add_paragraph_fixture
74- )
70+ document , text , style , paragraph_ = add_paragraph_fixture
7571 paragraph = document .add_paragraph (text , style )
76- document_part_ .add_paragraph .assert_called_once_with (text , style )
72+ document ._document_part .add_paragraph .assert_called_once_with (
73+ text , style
74+ )
7775 assert paragraph is paragraph_
7876
7977 def it_can_add_a_page_break (self , add_page_break_fixture ):
@@ -101,12 +99,10 @@ def it_can_add_a_section(self, add_section_fixture):
10199 assert section is section_
102100
103101 def it_can_add_a_table (self , add_table_fixture ):
104- document , rows , cols , style , document_part_ , expected_style , table_ = (
105- add_table_fixture
106- )
102+ document , rows , cols , style , table_ = add_table_fixture
107103 table = document .add_table (rows , cols , style )
108- document_part_ .add_table .assert_called_once_with (rows , cols )
109- assert table .style == expected_style
104+ document . _document_part .add_table .assert_called_once_with (rows , cols )
105+ assert table .style == style
110106 assert table == table_
111107
112108 def it_provides_access_to_the_document_inline_shapes (self , document ):
@@ -165,21 +161,25 @@ def it_creates_numbering_part_on_first_access_if_not_present(
165161
166162 @pytest .fixture (params = [
167163 ('' , None ),
168- ('' , 'Heading1 ' ),
169- ('foo\r bar' , 'BodyText ' ),
164+ ('' , 'Heading 1 ' ),
165+ ('foo\r bar' , 'Body Text ' ),
170166 ])
171- def add_paragraph_fixture (
172- self , request , document , document_part_ , paragraph_ ):
167+ def add_paragraph_fixture (self , request , document , document_part_ ,
168+ paragraph_ ):
173169 text , style = request .param
174- return document , document_part_ , text , style , paragraph_
170+ return document , text , style , paragraph_
175171
176- @pytest .fixture (params = [0 , 1 , 2 , 5 , 9 ])
177- def add_heading_fixture (
178- self , request , document , add_paragraph_ , paragraph_ ):
179- level = request .param
172+ @pytest .fixture (params = [
173+ (0 , 'Title' ),
174+ (1 , 'Heading 1' ),
175+ (2 , 'Heading 2' ),
176+ (9 , 'Heading 9' ),
177+ ])
178+ def add_heading_fixture (self , request , document , add_paragraph_ ,
179+ paragraph_ ):
180+ level , style = request .param
180181 text = 'Spam vs. Bacon'
181- style = 'Title' if level == 0 else 'Heading%d' % level
182- return document , add_paragraph_ , paragraph_ , text , level , style
182+ return document , text , level , style , paragraph_
183183
184184 @pytest .fixture
185185 def add_page_break_fixture (
@@ -199,14 +199,11 @@ def add_picture_fixture(self, request, run_, picture_):
199199 def add_section_fixture (self , document , start_type_ , section_ ):
200200 return document , start_type_ , section_
201201
202- @pytest .fixture ( params = [ None , 'LightShading-Accent1' , 'foobar' ])
202+ @pytest .fixture
203203 def add_table_fixture (self , request , document , document_part_ , table_ ):
204204 rows , cols = 4 , 2
205- style = expected_style = request .param
206- return (
207- document , rows , cols , style , document_part_ , expected_style ,
208- table_
209- )
205+ style = 'Light Shading Accent 1'
206+ return document , rows , cols , style , table_
210207
211208 @pytest .fixture
212209 def core_props_fixture (self , document , core_properties_ ):
0 commit comments