diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-11-21 01:01:36 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-11-21 01:01:36 +0900 |
commit | 3a4ae2092a6f236e2d71fdedb4b66f594e30d4e7 (patch) | |
tree | afa4f774e0f8660d5ce247f01cace9deaa848d58 /tests/test_intl.py | |
parent | f3a6004f822b05e352372a77f449332ad230d21e (diff) | |
parent | 18b2707b2ac621f23f8ee6a7ca19bf1590be7826 (diff) | |
download | sphinx-git-3a4ae2092a6f236e2d71fdedb4b66f594e30d4e7.tar.gz |
Merge branch '3.x'
Diffstat (limited to 'tests/test_intl.py')
-rw-r--r-- | tests/test_intl.py | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/tests/test_intl.py b/tests/test_intl.py index 4ffbf506d..775ffcd80 100644 --- a/tests/test_intl.py +++ b/tests/test_intl.py @@ -92,15 +92,6 @@ def assert_count(expected_expr, result, count): @sphinx_intl @pytest.mark.sphinx('text') @pytest.mark.test_params(shared_result='test_intl_basic') -def test_text_toctree(app): - app.build() - result = (app.outdir / 'index.txt').read_text() - assert_startswith(result, "CONTENTS\n********\n\nTABLE OF CONTENTS\n") - - -@sphinx_intl -@pytest.mark.sphinx('text') -@pytest.mark.test_params(shared_result='test_intl_basic') def test_text_emit_warnings(app, warning): app.build() # test warnings in translation @@ -436,11 +427,16 @@ def test_text_admonitions(app): @pytest.mark.test_params(shared_result='test_intl_gettext') def test_gettext_toctree(app): app.build() - # --- toctree + # --- toctree (index.rst) expect = read_po(app.srcdir / 'xx' / 'LC_MESSAGES' / 'index.po') actual = read_po(app.outdir / 'index.pot') for expect_msg in [m for m in expect if m.id]: assert expect_msg.id in [m.id for m in actual if m.id] + # --- toctree (toctree.rst) + expect = read_po(app.srcdir / 'xx' / 'LC_MESSAGES' / 'toctree.po') + actual = read_po(app.outdir / 'toctree.pot') + for expect_msg in [m for m in expect if m.id]: + assert expect_msg.id in [m.id for m in actual if m.id] @sphinx_intl @@ -468,23 +464,16 @@ def test_text_table(app): @sphinx_intl -@pytest.mark.sphinx('gettext') -@pytest.mark.test_params(shared_result='test_intl_gettext') -def test_gettext_toctree(app): - app.build() - # --- toctree - expect = read_po(app.srcdir / 'xx' / 'LC_MESSAGES' / 'toctree.po') - actual = read_po(app.outdir / 'toctree.pot') - for expect_msg in [m for m in expect if m.id]: - assert expect_msg.id in [m.id for m in actual if m.id] - - -@sphinx_intl @pytest.mark.sphinx('text') @pytest.mark.test_params(shared_result='test_intl_basic') def test_text_toctree(app): app.build() - # --- toctree + # --- toctree (index.rst) + # Note: index.rst contains contents that is not shown in text. + result = (app.outdir / 'index.txt').read_text() + assert 'CONTENTS' in result + assert 'TABLE OF CONTENTS' in result + # --- toctree (toctree.rst) 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]: |