@@ -1406,17 +1406,30 @@ def test_text_boxes_have_content_appended_after_containing_paragraph():
14061406 result = _read_and_get_document_xml_elements (paragraph )
14071407 assert_equal (result [1 ].style_id , "textbox-content" )
14081408
1409- def test_alternate_content_is_read_using_fallback ():
1410- element = xml_element ("mc:AlternateContent" , {}, [
1411- xml_element ("mc:Choice" , {"Requires" : "wps" }, [
1412- _paragraph_with_style_id ("first" )
1413- ]),
1414- xml_element ("mc:Fallback" , {}, [
1415- _paragraph_with_style_id ("second" )
1409+
1410+ class AlternateContentTests (object ):
1411+ def test_when_fallback_is_present_then_fallback_is_read (self ):
1412+ element = xml_element ("mc:AlternateContent" , {}, [
1413+ xml_element ("mc:Choice" , {"Requires" : "wps" }, [
1414+ _paragraph_with_style_id ("first" )
1415+ ]),
1416+ xml_element ("mc:Fallback" , {}, [
1417+ _paragraph_with_style_id ("second" )
1418+ ])
14161419 ])
1417- ])
1418- result = _read_and_get_document_xml_element (element )
1419- assert_equal ("second" , result .style_id )
1420+ result = _read_and_get_document_xml_element (element )
1421+ assert_equal ("second" , result .style_id )
1422+
1423+
1424+ def test_when_fallback_is_not_present_then_element_is_ignored (self ):
1425+ element = xml_element ("mc:AlternateContent" , {}, [
1426+ xml_element ("mc:Choice" , {"Requires" : "wps" }, [
1427+ _paragraph_with_style_id ("first" )
1428+ ]),
1429+ ])
1430+ result = _read_and_get_document_xml_elements (element )
1431+ assert_equal ([], result )
1432+
14201433
14211434def test_sdt_is_read_using_sdt_content ():
14221435 element = xml_element ("w:sdt" , {}, [
0 commit comments