diff options
Diffstat (limited to 'tests/test_intl.py')
-rw-r--r-- | tests/test_intl.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_intl.py b/tests/test_intl.py index 67507ed11..545d9c559 100644 --- a/tests/test_intl.py +++ b/tests/test_intl.py @@ -101,6 +101,26 @@ def test_i18n_footnote_regression(app): assert result == expect +@with_app(buildername='html', cleanenv=True, + confoverrides={'language': 'xx', 'locale_dirs': ['.'], + 'gettext_compact': False}) +def test_i18n_footnote_backlink(app): + """i18n test for #1058""" + app.builder.build(['i18n/footnote']) + result = (app.outdir / 'i18n' / 'footnote.html').text(encoding='utf-8') + expects = [ + '<a class="footnote-reference" href="#id5" id="id1">[100]</a>', + '<a class="footnote-reference" href="#id4" id="id2">[1]</a>', + '<a class="reference internal" href="#ref" id="id3">[ref]</a>', + '<a class="fn-backref" href="#id2">[1]</a>', + '<a class="fn-backref" href="#id3">[ref]</a>', + '<a class="fn-backref" href="#id1">[100]</a>', + ] + for expect in expects: + matches = re.findall(re.escape(expect), result) + assert len(matches) == 1 + + @with_app(buildername='text', warning=warnfile, cleanenv=True, confoverrides={'language': 'xx', 'locale_dirs': ['.'], 'gettext_compact': False}) @@ -206,3 +226,20 @@ def test_i18n_literalblock_warning(app): expected_warning_expr = u'.*/i18n/literalblock.txt:\\d+: ' \ u'WARNING: Literal block expected; none found.' assert re.search(expected_warning_expr, warnings) + + +@with_app(buildername='text', + confoverrides={'language': 'xx', 'locale_dirs': ['.'], + 'gettext_compact': False}) +def test_i18n_definition_terms(app): + # regression test for #975 + app.builder.build(['i18n/definition_terms']) + result = (app.outdir / 'i18n' / 'definition_terms.txt').text(encoding='utf-8') + expect = (u"\nI18N WITH DEFINITION TERMS" + u"\n**************************\n" + u"\nSOME TERM" + u"\n THE CORRESPONDING DEFINITION\n" + u"\nSOME OTHER TERM" + u"\n THE CORRESPONDING DEFINITION #2\n") + + assert result == expect |