diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-01-25 17:06:54 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-01-25 17:06:54 +0000 |
| commit | 1483a864719cedabc0d6c6bcd98e0b2d9d3ce0c1 (patch) | |
| tree | 8f5db7dde7d0f1952890f5ba97af7c958c212d13 /tests/mammoth_tests.py | |
| parent | abdcd67365d663c878fd370cb97e77ce74c2b1a7 (diff) | |
Use prefix to generate IDs
Diffstat (limited to 'tests/mammoth_tests.py')
| -rw-r--r-- | tests/mammoth_tests.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index 79ce50c..c5f2557 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -61,13 +61,13 @@ def word_tables_are_converted_to_html_tables(): def footnotes_are_appended_to_text(): # TODO: don't duplicate footnotes with multiple references expected_html = ('<p>Ouch' + - '<sup><a href="#footnote-42-1" id="footnote-ref-42-1">[1]</a></sup>.' + - '<sup><a href="#footnote-42-2" id="footnote-ref-42-2">[2]</a></sup></p>' + - '<ol><li id="footnote-42-1"><p> A tachyon walks into a bar. <a href="#footnote-ref-42-1">↑</a></p></li>' + - '<li id="footnote-42-2"><p> Fin. <a href="#footnote-ref-42-2">↑</a></p></li></ol>') + '<sup><a href="#doc-42-footnote-1" id="doc-42-footnote-ref-1">[1]</a></sup>.' + + '<sup><a href="#doc-42-footnote-2" id="doc-42-footnote-ref-2">[2]</a></sup></p>' + + '<ol><li id="doc-42-footnote-1"><p> A tachyon walks into a bar. <a href="#doc-42-footnote-ref-1">↑</a></p></li>' + + '<li id="doc-42-footnote-2"><p> Fin. <a href="#doc-42-footnote-ref-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) + result = mammoth.convert_to_html(fileobj=fileobj, id_prefix="doc-42") assert_equal([], result.messages) assert_equal(expected_html, result.value) @@ -75,13 +75,13 @@ 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>') + '<sup><a href="#doc-42-endnote-2" id="doc-42-endnote-ref-2">[1]</a></sup>.' + + '<sup><a href="#doc-42-endnote-3" id="doc-42-endnote-ref-3">[2]</a></sup></p>' + + '<ol><li id="doc-42-endnote-2"><p> A tachyon walks into a bar. <a href="#doc-42-endnote-ref-2">↑</a></p></li>' + + '<li id="doc-42-endnote-3"><p> Fin. <a href="#doc-42-endnote-ref-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) + result = mammoth.convert_to_html(fileobj=fileobj, id_prefix="doc-42") assert_equal([], result.messages) assert_equal(expected_html, result.value) |
