diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-08-31 10:44:16 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-08-31 10:44:16 +0100 |
| commit | 045edf1c661b09957e4f87c37981b209a29512ae (patch) | |
| tree | 3223ba0425a32fb98d7d639da7dbcbbfbcbae45c /tests | |
| parent | 7145a7199033988065f472af5a964587acbe06eb (diff) | |
Fix support on different Python versions
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/conversion_tests.py | 6 | ||||
| -rw-r--r-- | tests/docx/footnotes_xml_tests.py | 4 | ||||
| -rw-r--r-- | tests/mammoth_tests.py | 12 |
3 files changed, 13 insertions, 9 deletions
diff --git a/tests/conversion_tests.py b/tests/conversion_tests.py index 508d457..d9dde3e 100644 --- a/tests/conversion_tests.py +++ b/tests/conversion_tests.py @@ -1,5 +1,7 @@ # coding=utf-8 +from __future__ import unicode_literals + import io from nose.tools import istest, assert_equal @@ -286,8 +288,8 @@ def footnotes_are_included_after_the_main_body(): document, generate_uniquifier=lambda: 42 ) - expected_html = (u'<p>Knock knock<sup><a href="#footnote-42-4" id="footnote-ref-42-4">[1]</a></sup></p>' + - u'<ol><li id="footnote-42-4"><p>Who\'s there? <a href="#footnote-ref-42-4">↑</a></p></li></ol>') + expected_html = ('<p>Knock knock<sup><a href="#footnote-42-4" id="footnote-ref-42-4">[1]</a></sup></p>' + + '<ol><li id="footnote-42-4"><p>Who\'s there? <a href="#footnote-ref-42-4">↑</a></p></li></ol>') assert_equal(expected_html, result.value) diff --git a/tests/docx/footnotes_xml_tests.py b/tests/docx/footnotes_xml_tests.py index c3fed04..645f3d0 100644 --- a/tests/docx/footnotes_xml_tests.py +++ b/tests/docx/footnotes_xml_tests.py @@ -1,4 +1,4 @@ -from nose.tools import istest, assert_equal, assert_is +from nose.tools import istest, assert_equal from mammoth.docx.xmlparser import element as xml_element from mammoth.docx.footnotes_xml import read_footnotes_xml_element @@ -11,7 +11,7 @@ def id_and_body_of_footnote_are_read(): xml_element("w:footnote", {"w:id": "1"}, footnote_body), ])) assert_equal(1, len(footnotes)) - assert_is(footnote_body, footnotes[0].body) + assert footnote_body is footnotes[0].body assert_equal("1", footnotes[0].id) diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index f744711..70fac7d 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -1,5 +1,7 @@ # coding=utf-8 +from __future__ import unicode_literals + from nose.tools import istest, assert_equal from .testing import test_path @@ -58,11 +60,11 @@ def word_tables_are_converted_to_html_tables(): @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>') + 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>') with open(test_path("footnotes.docx"), "rb") as fileobj: result = mammoth.convert_to_html(fileobj=fileobj, generate_uniquifier=lambda: 42) |
