diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-12-05 19:29:10 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-12-05 19:29:10 +0000 |
| commit | 414cb49cd08d4952cf5eff51bd9e2da811c4661b (patch) | |
| tree | b237b5f402d7f7f5f80c6c93bc1c3415e9cfe146 /tests/docx/docx_tests.py | |
| parent | 3646167ab5685ea5a69de24442cf46e963bf7f41 (diff) | |
Revert "Handle XML documents that are missing a root element"
This reverts commit 659c4ffe6ade2d8132873ae3f3f3a22df38fdb37.
Diffstat (limited to 'tests/docx/docx_tests.py')
| -rw-r--r-- | tests/docx/docx_tests.py | 33 |
1 files changed, 0 insertions, 33 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({ |
