@@ -373,6 +373,11 @@ def it_knows_whether_it_is_subscript(self, subscript_get_fixture):
373373 font , expected_value = subscript_get_fixture
374374 assert font .subscript == expected_value
375375
376+ def it_can_change_whether_it_is_subscript (self , subscript_set_fixture ):
377+ font , value , expected_xml = subscript_set_fixture
378+ font .subscript = value
379+ assert font ._element .xml == expected_xml
380+
376381 def it_knows_whether_it_is_superscript (self , superscript_get_fixture ):
377382 font , expected_value = superscript_get_fixture
378383 assert font .superscript == expected_value
@@ -535,6 +540,34 @@ def subscript_get_fixture(self, request):
535540 font = Font (element (r_cxml ))
536541 return font , expected_value
537542
543+ @pytest .fixture (params = [
544+ ('w:r' , True ,
545+ 'w:r/w:rPr/w:vertAlign{w:val=subscript}' ),
546+ ('w:r' , False ,
547+ 'w:r/w:rPr' ),
548+ ('w:r' , None ,
549+ 'w:r/w:rPr' ),
550+ ('w:r/w:rPr/w:vertAlign{w:val=subscript}' , True ,
551+ 'w:r/w:rPr/w:vertAlign{w:val=subscript}' ),
552+ ('w:r/w:rPr/w:vertAlign{w:val=subscript}' , False ,
553+ 'w:r/w:rPr' ),
554+ ('w:r/w:rPr/w:vertAlign{w:val=subscript}' , None ,
555+ 'w:r/w:rPr' ),
556+ ('w:r/w:rPr/w:vertAlign{w:val=superscript}' , True ,
557+ 'w:r/w:rPr/w:vertAlign{w:val=subscript}' ),
558+ ('w:r/w:rPr/w:vertAlign{w:val=superscript}' , False ,
559+ 'w:r/w:rPr/w:vertAlign{w:val=superscript}' ),
560+ ('w:r/w:rPr/w:vertAlign{w:val=superscript}' , None ,
561+ 'w:r/w:rPr' ),
562+ ('w:r/w:rPr/w:vertAlign{w:val=baseline}' , True ,
563+ 'w:r/w:rPr/w:vertAlign{w:val=subscript}' ),
564+ ])
565+ def subscript_set_fixture (self , request ):
566+ r_cxml , value , expected_r_cxml = request .param
567+ font = Font (element (r_cxml ))
568+ expected_xml = xml (expected_r_cxml )
569+ return font , value , expected_xml
570+
538571 @pytest .fixture (params = [
539572 ('w:r' , None ),
540573 ('w:r/w:rPr' , None ),
0 commit comments