aboutsummaryrefslogtreecommitdiff
path: root/tests/docx/office_xml_tests.py
blob: 5b8b1e19f34e29a93b119b04050fea5a772b7063 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from __future__ import unicode_literals

import io

from nose.tools import istest, assert_equal

from mammoth.docx import xmlparser as xml, office_xml


@istest
def alternate_content_is_replaced_by_contents_of_fallback():
    xml_string = (
        '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
        '<numbering xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">' +
        '<mc:AlternateContent>' +
        '<mc:Choice Requires="w14">' +
        '<choice/>' +
        '</mc:Choice>' +
        '<mc:Fallback>' +
        '<fallback/>' +
        '</mc:Fallback>' +
        '</mc:AlternateContent>' +
        '</numbering>')
    
    result = office_xml.read(io.StringIO(xml_string))
    assert_equal([xml.element("fallback")], result.children)