aboutsummaryrefslogtreecommitdiff
path: root/tests/docx
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-12-26 11:01:22 +0000
committerMichael Williamson <mike@zwobble.org>2015-12-26 11:08:18 +0000
commit03f7d77da6ce807effa5494f161aab07fdd2498c (patch)
tree631d62cfc647e139a9ca27097c250af834d1ff59 /tests/docx
parent5a5112f8c0286da6875e54b2e61a32288135d1e8 (diff)
Always use mc:Fallback when reading mc:AlternateContent elements
Diffstat (limited to 'tests/docx')
-rw-r--r--tests/docx/office_xml_tests.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/docx/office_xml_tests.py b/tests/docx/office_xml_tests.py
new file mode 100644
index 0000000..5b8b1e1
--- /dev/null
+++ b/tests/docx/office_xml_tests.py
@@ -0,0 +1,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)