From 0cf349525bee7ff17e8db3f8d04f6d1e9218d3f2 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 21 Jan 2015 19:41:46 +0000 Subject: Add support for endnotes --- tests/mammoth_tests.py | 15 +++++++++++++++ tests/test-data/endnotes.docx | Bin 0 -> 4431 bytes 2 files changed, 15 insertions(+) create mode 100644 tests/test-data/endnotes.docx (limited to 'tests') diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index 70fac7d..24b2cc9 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -73,6 +73,21 @@ def footnotes_are_appended_to_text(): assert_equal(expected_html, result.value) +@istest +def endnotes_are_appended_to_text(): + expected_html = ('

Ouch' + + '[1].' + + '[2]

' + + '
  1. A tachyon walks into a bar. ↑

  2. ' + + '
  3. Fin. ↑

') + + with open(test_path("endnotes.docx"), "rb") as fileobj: + result = mammoth.convert_to_html(fileobj=fileobj, generate_uniquifier=lambda: 42) + # TODO: get rid of warnings + #~ assert_equal([], result.messages) + assert_equal(expected_html, result.value) + + @istest def transform_document_is_applied_to_document_before_conversion(): def transform_document(document): diff --git a/tests/test-data/endnotes.docx b/tests/test-data/endnotes.docx new file mode 100644 index 0000000..1ae4f93 Binary files /dev/null and b/tests/test-data/endnotes.docx differ -- cgit v1.2.3