@@ -52,9 +52,12 @@ def it_knows_its_table_style(self, style_get_fixture):
5252 )
5353 assert style is style_
5454
55- def it_can_apply_a_table_style_by_name (self , table_style_set_fixture ):
56- table , style_name , expected_xml = table_style_set_fixture
57- table .style = style_name
55+ def it_can_change_its_table_style (self , style_set_fixture ):
56+ table , value , expected_xml = style_set_fixture
57+ table .style = value
58+ table .part .get_style_id .assert_called_once_with (
59+ value , WD_STYLE_TYPE .TABLE
60+ )
5861 assert table ._tbl .xml == expected_xml
5962
6063 def it_knows_it_is_the_table_its_children_belong_to (self , table_fixture ):
@@ -233,26 +236,25 @@ def style_get_fixture(self, part_prop_):
233236 style_ = part_prop_ .return_value .get_style .return_value
234237 return table , style_id , style_
235238
236- @pytest .fixture
237- def table_fixture (self ):
238- table = Table (None , None )
239- return table
240-
241239 @pytest .fixture (params = [
242- ('w:tbl/w:tblPr' , 'foobar' ,
243- 'w:tbl/w:tblPr/w:tblStyle{w:val=foobar}' ),
244- ('w:tbl/w:tblPr/w:tblStyle{w:val=foobar}' , 'barfoo' ,
245- 'w:tbl/w:tblPr/w:tblStyle{w:val=barfoo}' ),
246- ('w:tbl/w:tblPr/w:tblStyle{w:val=foobar}' , None ,
247- 'w:tbl/w:tblPr' ),
248- ('w:tbl/w:tblPr' , None ,
240+ ('w:tbl/w:tblPr' , 'Tbl A' , 'TblA' ,
241+ 'w:tbl/w:tblPr/w:tblStyle{w:val=TblA}' ),
242+ ('w:tbl/w:tblPr/w:tblStyle{w:val=TblA}' , 'Tbl B' , 'TblB' ,
243+ 'w:tbl/w:tblPr/w:tblStyle{w:val=TblB}' ),
244+ ('w:tbl/w:tblPr/w:tblStyle{w:val=TblB}' , None , None ,
249245 'w:tbl/w:tblPr' ),
250246 ])
251- def table_style_set_fixture (self , request ):
252- tbl_cxml , new_style , expected_cxml = request .param
247+ def style_set_fixture (self , request , part_prop_ ):
248+ tbl_cxml , value , style_id , expected_cxml = request .param
253249 table = Table (element (tbl_cxml ), None )
250+ part_prop_ .return_value .get_style_id .return_value = style_id
254251 expected_xml = xml (expected_cxml )
255- return table , new_style , expected_xml
252+ return table , value , expected_xml
253+
254+ @pytest .fixture
255+ def table_fixture (self ):
256+ table = Table (None , None )
257+ return table
256258
257259 # fixture components ---------------------------------------------
258260
0 commit comments