aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-01-21 19:41:46 +0000
committerMichael Williamson <mike@zwobble.org>2015-01-21 19:41:46 +0000
commit0cf349525bee7ff17e8db3f8d04f6d1e9218d3f2 (patch)
tree462826c044f01e8814d458e5c6cbca35e7c416d4 /tests
parent72e5c9810f9ec8f88d62491f37a68abd9927e6fd (diff)
Add support for endnotes
Diffstat (limited to 'tests')
-rw-r--r--tests/mammoth_tests.py15
-rw-r--r--tests/test-data/endnotes.docxbin0 -> 4431 bytes
2 files changed, 15 insertions, 0 deletions
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
@@ -74,6 +74,21 @@ def footnotes_are_appended_to_text():
@istest
+def endnotes_are_appended_to_text():
+ expected_html = ('<p>Ouch' +
+ '<sup><a href="#endnote-42-2" id="endnote-ref-42-2">[1]</a></sup>.' +
+ '<sup><a href="#endnote-42-3" id="endnote-ref-42-3">[2]</a></sup></p>' +
+ '<ol><li id="endnote-42-2"><p> A tachyon walks into a bar. <a href="#endnote-ref-42-2">↑</a></p></li>' +
+ '<li id="endnote-42-3"><p> Fin. <a href="#endnote-ref-42-3">↑</a></p></li></ol>')
+
+ 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):
document.children[0].style_id = "Heading1"
diff --git a/tests/test-data/endnotes.docx b/tests/test-data/endnotes.docx
new file mode 100644
index 0000000..1ae4f93
--- /dev/null
+++ b/tests/test-data/endnotes.docx
Binary files differ