From 1483a864719cedabc0d6c6bcd98e0b2d9d3ce0c1 Mon Sep 17 00:00:00 2001
From: Michael Williamson
Date: Sun, 25 Jan 2015 17:06:54 +0000
Subject: Use prefix to generate IDs
---
tests/conversion_tests.py | 10 +++++-----
tests/docx/document_xml_tests.py | 2 +-
tests/mammoth_tests.py | 20 ++++++++++----------
3 files changed, 16 insertions(+), 16 deletions(-)
(limited to 'tests')
diff --git a/tests/conversion_tests.py b/tests/conversion_tests.py
index 39c57cd..78fbce5 100644
--- a/tests/conversion_tests.py
+++ b/tests/conversion_tests.py
@@ -289,9 +289,9 @@ def footnote_reference_is_converted_to_superscript_intra_page_link():
footnote_reference = documents.note_reference("footnote", "4")
result = convert_document_element_to_html(
footnote_reference,
- generate_uniquifier=lambda: 42
+ id_prefix="doc-42"
)
- assert_equal('', result.value)
+ assert_equal('', result.value)
@istest
@@ -308,10 +308,10 @@ def footnotes_are_included_after_the_main_body():
)
result = convert_document_element_to_html(
document,
- generate_uniquifier=lambda: 42
+ id_prefix="doc-42"
)
- expected_html = ('Knock knock
' +
- '
')
+ expected_html = ('Knock knock
' +
+ '
')
assert_equal(expected_html, result.value)
diff --git a/tests/docx/document_xml_tests.py b/tests/docx/document_xml_tests.py
index a0d29b9..a2eefaf 100644
--- a/tests/docx/document_xml_tests.py
+++ b/tests/docx/document_xml_tests.py
@@ -322,7 +322,7 @@ class ReadXmlElementTests(object):
document = _read_and_get_document_xml_element(document_xml, footnote_elements=footnotes)
footnote = document.notes.find_note("footnote", "4")
- assert_equal("4", footnote.id)
+ assert_equal("4", footnote.note_id)
assert isinstance(footnote.body[0], documents.Paragraph)
@istest
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 = ('Ouch' +
- '.' +
- '
' +
- '' +
- '
')
+ '.' +
+ '
' +
+ '' +
+ '
')
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 = ('Ouch' +
- '[1].' +
- '[2]
' +
- ' A tachyon walks into a bar. ↑
' +
- ' Fin. ↑
')
+ '[1].' +
+ '[2]' +
+ ' A tachyon walks into a bar. ↑
' +
+ ' Fin. ↑
')
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)
--
cgit v1.2.3