aboutsummaryrefslogtreecommitdiff
path: root/tests/docx/office_xml_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/docx/office_xml_tests.py')
-rw-r--r--tests/docx/office_xml_tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/docx/office_xml_tests.py b/tests/docx/office_xml_tests.py
index 05897db..34566ff 100644
--- a/tests/docx/office_xml_tests.py
+++ b/tests/docx/office_xml_tests.py
@@ -2,10 +2,18 @@ from __future__ import unicode_literals
import io
+import pytest
+
from mammoth.docx import xmlparser as xml, office_xml
from ..testing import assert_equal
+def test_when_document_is_missing_root_element_then_none_is_returned():
+ xml_string = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
+
+ pytest.raises(xml.NoRootElementError, lambda: office_xml.read(io.StringIO(xml_string)))
+
+
class AlternateContentTests(object):
def test_when_fallback_is_present_then_fallback_is_read(self):
xml_string = (