summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-08-30 12:02:49 +0100
committerMichael Williamson <mike@zwobble.org>2014-08-30 12:02:49 +0100
commitf4df40207f5ff873ac4f2e155373e7a10ee0ddca (patch)
treea2923addccd51977727745026ea3a4f5969a18cd /tests
parentcc671a920c1ce5886fcc6629965000bfc469fea1 (diff)
Support footnotes
Diffstat (limited to 'tests')
-rw-r--r--tests/mammoth_tests.py19
-rwxr-xr-xtests/test-data/footnotes.docxbin0 -> 15936 bytes
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py
index 7ef8049..f744711 100644
--- a/tests/mammoth_tests.py
+++ b/tests/mammoth_tests.py
@@ -1,3 +1,5 @@
+# coding=utf-8
+
from nose.tools import istest, assert_equal
from .testing import test_path
@@ -52,6 +54,23 @@ def word_tables_are_converted_to_html_tables():
assert_equal([], result.messages)
assert_equal(expected_html, result.value)
+
+@istest
+def footnotes_are_appended_to_text():
+ # TODO: don't duplicate footnotes with multiple references
+ expected_html = (u'<p>Ouch' +
+ u'<sup><a href="#footnote-42-1" id="footnote-ref-42-1">[1]</a></sup>.' +
+ u'<sup><a href="#footnote-42-2" id="footnote-ref-42-2">[2]</a></sup></p>' +
+ u'<ol><li id="footnote-42-1"><p> A tachyon walks into a bar. <a href="#footnote-ref-42-1">↑</a></p></li>' +
+ u'<li id="footnote-42-2"><p> Fin. <a href="#footnote-ref-42-2">↑</a></p></li></ol>')
+
+ with open(test_path("footnotes.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/footnotes.docx b/tests/test-data/footnotes.docx
new file mode 100755
index 0000000..3228e74
--- /dev/null
+++ b/tests/test-data/footnotes.docx
Binary files differ