From 659c4ffe6ade2d8132873ae3f3f3a22df38fdb37 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 5 Dec 2026 11:06:47 +0000 Subject: Handle XML documents that are missing a root element --- tests/docx/xmlparser_tests.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/docx/xmlparser_tests.py') diff --git a/tests/docx/xmlparser_tests.py b/tests/docx/xmlparser_tests.py index 75fc35a..65479fc 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 +from mammoth.docx.xmlparser import parse_xml, element as xml_element, text as xml_text, NoRootElementError from ..testing import assert_equal @@ -60,6 +60,13 @@ def test_error_if_xml_is_badly_formed(): pytest.raises(Exception, lambda: _parse_xml_string(b''), + ) + + class FindChildTests(object): def test_returns_none_if_no_children(self): xml = xml_element("a") -- cgit v1.2.3