@@ -468,6 +468,11 @@ def it_knows_its_next_paragraph_style(self, next_get_fixture):
468468 style , expected_value = next_get_fixture
469469 assert style .next_paragraph_style == expected_value
470470
471+ def it_can_change_its_next_paragraph_style (self , next_set_fixture ):
472+ style , next_style , expected_xml = next_set_fixture
473+ style .next_paragraph_style = next_style
474+ assert style .element .xml == expected_xml
475+
471476 def it_provides_access_to_its_paragraph_format (self , parfmt_fixture ):
472477 style , ParagraphFormat_ , paragraph_format_ = parfmt_fixture
473478 paragraph_format = style .paragraph_format
@@ -502,6 +507,27 @@ def next_get_fixture(self, request):
502507 next_style = style
503508 return style , next_style
504509
510+ @pytest .fixture (params = [
511+ ('H' , 'B' , 'w:style{w:type=paragraph,w:styleId=H}/w:next{w:val=B}' ),
512+ ('H' , None , 'w:style{w:type=paragraph,w:styleId=H}' ),
513+ ('H' , 'H' , 'w:style{w:type=paragraph,w:styleId=H}' ),
514+ ])
515+ def next_set_fixture (self , request ):
516+ style_name , next_style_name , style_cxml = request .param
517+ styles = element (
518+ 'w:styles/('
519+ 'w:style{w:type=paragraph,w:styleId=H},'
520+ 'w:style{w:type=paragraph,w:styleId=B})'
521+ )
522+ style_elms = {'H' : styles [0 ], 'B' : styles [1 ]}
523+ style = _ParagraphStyle (style_elms [style_name ])
524+ next_style = (
525+ None if next_style_name is None else
526+ _ParagraphStyle (style_elms [next_style_name ])
527+ )
528+ expected_xml = xml (style_cxml )
529+ return style , next_style , expected_xml
530+
505531 @pytest .fixture
506532 def parfmt_fixture (self , ParagraphFormat_ , paragraph_format_ ):
507533 style = _ParagraphStyle (element ('w:style' ))
0 commit comments