summaryrefslogtreecommitdiff
path: root/tests/docx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/docx')
-rw-r--r--tests/docx/docx_tests.py33
-rw-r--r--tests/docx/office_xml_tests.py8
-rw-r--r--tests/docx/xmlparser_tests.py9
3 files changed, 1 insertions, 49 deletions
diff --git a/tests/docx/docx_tests.py b/tests/docx/docx_tests.py
index c409e11..ee6b928 100644
--- a/tests/docx/docx_tests.py
+++ b/tests/docx/docx_tests.py
@@ -72,39 +72,6 @@ def test_error_is_raised_when_main_document_part_does_not_exist():
str(error),
)
-
-def test_when_main_document_part_is_empty_then_error_is_raised():
- fileobj = _create_zip({
- "word/document.xml": textwrap.dedent("""\
- <?xml version="1.0" encoding="utf-8" ?>
- """),
- })
-
- error = assert_raises(IOError, lambda: docx.read(fileobj=fileobj))
-
- assert_equal(
- "Main document part is missing root element. Are you sure this is a valid .docx file?",
- str(error),
- )
-
-
-def test_when_part_other_than_main_document_is_empty_then_part_is_ignored():
- fileobj = _create_zip({
- "word/document.xml": textwrap.dedent("""\
- <?xml version="1.0" encoding="utf-8" ?>
- <w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
- <w:body/>
- </w:document>
- """),
- "word/footnotes.xml": textwrap.dedent("""\
- <?xml version="1.0" encoding="utf-8" ?>
- """),
- })
- result = docx.read(fileobj=fileobj)
- expected_document = documents.document([])
- assert_equal(expected_document, result.value)
-
-
class PartPathsTests(object):
def test_main_document_part_is_found_using_package_relationships(self):
fileobj = _create_zip({
diff --git a/tests/docx/office_xml_tests.py b/tests/docx/office_xml_tests.py
index 34566ff..05897db 100644
--- a/tests/docx/office_xml_tests.py
+++ b/tests/docx/office_xml_tests.py
@@ -2,18 +2,10 @@ 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 = (
diff --git a/tests/docx/xmlparser_tests.py b/tests/docx/xmlparser_tests.py
index 65479fc..75fc35a 100644
--- a/tests/docx/xmlparser_tests.py
+++ b/tests/docx/xmlparser_tests.py
@@ -2,7 +2,7 @@ import io
import pytest
-from mammoth.docx.xmlparser import parse_xml, element as xml_element, text as xml_text, NoRootElementError
+from mammoth.docx.xmlparser import parse_xml, element as xml_element, text as xml_text
from ..testing import assert_equal
@@ -60,13 +60,6 @@ def test_error_if_xml_is_badly_formed():
pytest.raises(Exception, lambda: _parse_xml_string(b'<bo'))
-def test_when_document_is_missing_root_element_then_error_is_raised():
- pytest.raises(
- NoRootElementError,
- lambda: _parse_xml_string(b'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),
- )
-
-
class FindChildTests(object):
def test_returns_none_if_no_children(self):
xml = xml_element("a")