summaryrefslogtreecommitdiff
path: root/tests/test_intl.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_intl.py')
-rw-r--r--tests/test_intl.py62
1 files changed, 31 insertions, 31 deletions
diff --git a/tests/test_intl.py b/tests/test_intl.py
index f038c2b28..0e7dd4f62 100644
--- a/tests/test_intl.py
+++ b/tests/test_intl.py
@@ -95,7 +95,7 @@ def assert_count(expected_expr, result, count):
@pytest.mark.test_params(shared_result='test_intl_basic')
def test_text_toctree(app):
app.build()
- result = (app.outdir / 'index.txt').text()
+ result = (app.outdir / 'index.txt').read_text()
assert_startswith(result, "CONTENTS\n********\n\nTABLE OF CONTENTS\n")
@@ -117,7 +117,7 @@ def test_text_emit_warnings(app, warning):
def test_text_warning_node(app):
app.build()
# test warnings in translation
- result = (app.outdir / 'warnings.txt').text()
+ result = (app.outdir / 'warnings.txt').read_text()
expect = ("3. I18N WITH REST WARNINGS"
"\n**************************\n"
"\nLINE OF >>``<<BROKEN LITERAL MARKUP.\n")
@@ -131,7 +131,7 @@ def test_text_warning_node(app):
def test_text_title_underline(app):
app.build()
# --- simple translation; check title underlines
- result = (app.outdir / 'bom.txt').text()
+ result = (app.outdir / 'bom.txt').read_text()
expect = ("2. Datei mit UTF-8"
"\n******************\n" # underline matches new translation
"\nThis file has umlauts: äöü.\n")
@@ -144,7 +144,7 @@ def test_text_title_underline(app):
def test_text_subdirs(app):
app.build()
# --- check translation in subdirs
- result = (app.outdir / 'subdir' / 'index.txt').text()
+ result = (app.outdir / 'subdir' / 'index.txt').read_text()
assert_startswith(result, "1. subdir contents\n******************\n")
@@ -154,7 +154,7 @@ def test_text_subdirs(app):
def test_text_inconsistency_warnings(app, warning):
app.build()
# --- check warnings for inconsistency in number of references
- result = (app.outdir / 'refs_inconsistency.txt').text()
+ result = (app.outdir / 'refs_inconsistency.txt').read_text()
expect = ("8. I18N WITH REFS INCONSISTENCY"
"\n*******************************\n"
"\n* FOR CITATION [ref3].\n"
@@ -204,7 +204,7 @@ def test_text_inconsistency_warnings(app, warning):
def test_text_literalblock_warnings(app, warning):
app.build()
# --- check warning for literal block
- result = (app.outdir / 'literalblock.txt').text()
+ result = (app.outdir / 'literalblock.txt').read_text()
expect = ("9. I18N WITH LITERAL BLOCK"
"\n**************************\n"
"\nCORRECT LITERAL BLOCK:\n"
@@ -226,7 +226,7 @@ def test_text_literalblock_warnings(app, warning):
def test_text_definition_terms(app):
app.build()
# --- definition terms: regression test for #975, #2198, #2205
- result = (app.outdir / 'definition_terms.txt').text()
+ result = (app.outdir / 'definition_terms.txt').read_text()
expect = ("13. I18N WITH DEFINITION TERMS"
"\n******************************\n"
"\nSOME TERM"
@@ -246,7 +246,7 @@ def test_text_definition_terms(app):
def test_text_glossary_term(app, warning):
app.build()
# --- glossary terms: regression test for #1090
- result = (app.outdir / 'glossary_terms.txt').text()
+ result = (app.outdir / 'glossary_terms.txt').read_text()
expect = ("18. I18N WITH GLOSSARY TERMS"
"\n****************************\n"
"\nSOME NEW TERM"
@@ -265,7 +265,7 @@ def test_text_glossary_term(app, warning):
def test_text_glossary_term_inconsistencies(app, warning):
app.build()
# --- glossary term inconsistencies: regression test for #1090
- result = (app.outdir / 'glossary_terms_inconsistency.txt').text()
+ result = (app.outdir / 'glossary_terms_inconsistency.txt').read_text()
expect = ("19. I18N WITH GLOSSARY TERMS INCONSISTENCY"
"\n******************************************\n"
"\n1. LINK TO *SOME NEW TERM*.\n")
@@ -298,7 +298,7 @@ def test_gettext_section(app):
def test_text_section(app):
app.build()
# --- section
- result = (app.outdir / 'section.txt').text()
+ result = (app.outdir / 'section.txt').read_text()
expect = read_po(app.srcdir / 'xx' / 'LC_MESSAGES' / 'section.po')
for expect_msg in [m for m in expect if m.id]:
assert expect_msg.string in result
@@ -310,7 +310,7 @@ def test_text_section(app):
def test_text_seealso(app):
app.build()
# --- seealso
- result = (app.outdir / 'seealso.txt').text()
+ result = (app.outdir / 'seealso.txt').read_text()
expect = ("12. I18N WITH SEEALSO"
"\n*********************\n"
"\nSee also: SHORT TEXT 1\n"
@@ -327,7 +327,7 @@ def test_text_seealso(app):
def test_text_figure_captions(app):
app.build()
# --- figure captions: regression test for #940
- result = (app.outdir / 'figure.txt').text()
+ result = (app.outdir / 'figure.txt').read_text()
expect = ("14. I18N WITH FIGURE CAPTION"
"\n****************************\n"
"\n [image]MY CAPTION OF THE FIGURE\n"
@@ -371,7 +371,7 @@ def test_text_figure_captions(app):
def test_text_rubric(app):
app.build()
# --- rubric: regression test for pull request #190
- result = (app.outdir / 'rubric.txt').text()
+ result = (app.outdir / 'rubric.txt').read_text()
expect = ("I18N WITH RUBRIC"
"\n****************\n"
"\n-[ RUBRIC TITLE ]-\n"
@@ -389,7 +389,7 @@ def test_text_rubric(app):
def test_text_docfields(app):
app.build()
# --- docfields
- result = (app.outdir / 'docfields.txt').text()
+ result = (app.outdir / 'docfields.txt').read_text()
expect = ("21. I18N WITH DOCFIELDS"
"\n***********************\n"
"\nclass Cls1\n"
@@ -420,7 +420,7 @@ def test_text_admonitions(app):
# --- admonitions
# #1206: gettext did not translate admonition directive's title
# seealso: http://docutils.sourceforge.net/docs/ref/rst/directives.html#admonitions
- result = (app.outdir / 'admonitions.txt').text()
+ result = (app.outdir / 'admonitions.txt').read_text()
directives = (
"attention", "caution", "danger", "error", "hint",
"important", "note", "tip", "warning", "admonition")
@@ -462,7 +462,7 @@ def test_gettext_table(app):
def test_text_table(app):
app.build()
# --- toctree
- result = (app.outdir / 'table.txt').text()
+ result = (app.outdir / 'table.txt').read_text()
expect = read_po(app.srcdir / 'xx' / 'LC_MESSAGES' / 'table.po')
for expect_msg in [m for m in expect if m.id]:
assert expect_msg.string in result
@@ -486,7 +486,7 @@ def test_gettext_toctree(app):
def test_text_toctree(app):
app.build()
# --- toctree
- result = (app.outdir / 'toctree.txt').text()
+ result = (app.outdir / 'toctree.txt').read_text()
expect = read_po(app.srcdir / 'xx' / 'LC_MESSAGES' / 'toctree.po')
for expect_msg in [m for m in expect if m.id]:
assert expect_msg.string in result
@@ -510,7 +510,7 @@ def test_gettext_topic(app):
def test_text_topic(app):
app.build()
# --- topic
- result = (app.outdir / 'topic.txt').text()
+ result = (app.outdir / 'topic.txt').read_text()
expect = read_po(app.srcdir / 'xx' / 'LC_MESSAGES' / 'topic.po')
for expect_msg in [m for m in expect if m.id]:
assert expect_msg.string in result
@@ -628,7 +628,7 @@ def test_gettext_dont_rebuild_mo(make_app, app_params):
def test_html_meta(app):
app.build()
# --- test for meta
- result = (app.outdir / 'index.html').text()
+ result = (app.outdir / 'index.html').read_text()
expected_expr = '<meta content="TESTDATA FOR I18N" name="description" />'
assert expected_expr in result
expected_expr = '<meta content="I18N, SPHINX, MARKUP" name="keywords" />'
@@ -644,7 +644,7 @@ def test_html_footnotes(app):
app.build()
# --- test for #955 cant-build-html-with-footnotes-when-using
# expect no error by build
- (app.outdir / 'footnote.html').text()
+ (app.outdir / 'footnote.html').read_text()
@sphinx_intl
@@ -653,7 +653,7 @@ def test_html_footnotes(app):
def test_html_undefined_refs(app):
app.build()
# --- links to undefined reference
- result = (app.outdir / 'refs_inconsistency.html').text()
+ result = (app.outdir / 'refs_inconsistency.html').read_text()
expected_expr = ('<a class="reference external" '
'href="http://www.example.com">reference</a>')
@@ -675,7 +675,7 @@ def test_html_undefined_refs(app):
def test_html_index_entries(app):
app.build()
# --- index entries: regression test for #976
- result = (app.outdir / 'genindex.html').text()
+ result = (app.outdir / 'genindex.html').read_text()
def wrap(tag, keyword):
start_tag = "<%s[^>]*>" % tag
@@ -713,7 +713,7 @@ def test_html_index_entries(app):
def test_html_versionchanges(app):
app.build()
# --- versionchanges
- result = (app.outdir / 'versionchange.html').text()
+ result = (app.outdir / 'versionchange.html').read_text()
def get_content(result, name):
matched = re.search(r'<div class="%s">\n*(.*?)</div>' % name,
@@ -750,7 +750,7 @@ def test_html_docfields(app):
app.build()
# --- docfields
# expect no error by build
- (app.outdir / 'docfields.html').text()
+ (app.outdir / 'docfields.html').read_text()
@sphinx_intl
@@ -759,7 +759,7 @@ def test_html_docfields(app):
def test_html_template(app):
app.build()
# --- gettext template
- result = (app.outdir / 'contents.html').text()
+ result = (app.outdir / 'contents.html').read_text()
assert "WELCOME" in result
assert "SPHINX 2013.120" in result
@@ -1056,7 +1056,7 @@ def test_xml_label_targets(app):
def test_additional_targets_should_not_be_translated(app):
app.build()
# [literalblock.txt]
- result = (app.outdir / 'literalblock.html').text()
+ result = (app.outdir / 'literalblock.html').read_text()
# title should be translated
expected_expr = 'CODE-BLOCKS'
@@ -1092,7 +1092,7 @@ def test_additional_targets_should_not_be_translated(app):
# [raw.txt]
- result = (app.outdir / 'raw.html').text()
+ result = (app.outdir / 'raw.html').read_text()
# raw block should not be translated
expected_expr = """<iframe src="http://sphinx-doc.org"></iframe></div>"""
@@ -1100,7 +1100,7 @@ def test_additional_targets_should_not_be_translated(app):
# [figure.txt]
- result = (app.outdir / 'figure.html').text()
+ result = (app.outdir / 'figure.html').read_text()
# alt and src for image block should not be translated
expected_expr = """<img alt="i18n" src="_images/i18n.png" />"""
@@ -1130,7 +1130,7 @@ def test_additional_targets_should_not_be_translated(app):
def test_additional_targets_should_be_translated(app):
app.build()
# [literalblock.txt]
- result = (app.outdir / 'literalblock.html').text()
+ result = (app.outdir / 'literalblock.html').read_text()
# title should be translated
expected_expr = 'CODE-BLOCKS'
@@ -1166,7 +1166,7 @@ def test_additional_targets_should_be_translated(app):
# [raw.txt]
- result = (app.outdir / 'raw.html').text()
+ result = (app.outdir / 'raw.html').read_text()
# raw block should be translated
expected_expr = """<iframe src="HTTP://SPHINX-DOC.ORG"></iframe></div>"""
@@ -1174,7 +1174,7 @@ def test_additional_targets_should_be_translated(app):
# [figure.txt]
- result = (app.outdir / 'figure.html').text()
+ result = (app.outdir / 'figure.html').read_text()
# alt and src for image block should be translated
expected_expr = """<img alt="I18N -&gt; IMG" src="_images/img.png" />"""