diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-12-05 10:21:42 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-12-05 10:21:42 +0000 |
| commit | 6e62be83305ba864caf8e6bc1afff954dc6f3d91 (patch) | |
| tree | 5a2e017a086085099ebdad69d6dea1d9637d9e59 /tests/docx | |
| parent | f3b7b9fc73fdbffe6ebac77e6b3ac6c418ee33d9 (diff) | |
Test behaviour of reader when XML is badly formed
Diffstat (limited to 'tests/docx')
| -rw-r--r-- | tests/docx/xmlparser_tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/docx/xmlparser_tests.py b/tests/docx/xmlparser_tests.py index 8c960eb..75fc35a 100644 --- a/tests/docx/xmlparser_tests.py +++ b/tests/docx/xmlparser_tests.py @@ -1,5 +1,7 @@ import io +import pytest + from mammoth.docx.xmlparser import parse_xml, element as xml_element, text as xml_text from ..testing import assert_equal @@ -54,6 +56,10 @@ def test_whitespace_between_xml_declaration_and_root_tag_is_ignored(): assert_equal("body", xml.name) +def test_error_if_xml_is_badly_formed(): + pytest.raises(Exception, lambda: _parse_xml_string(b'<bo')) + + class FindChildTests(object): def test_returns_none_if_no_children(self): xml = xml_element("a") |
