summaryrefslogtreecommitdiff
path: root/tests/test_domain_py.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-02-05 21:13:14 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-02-29 18:23:58 +0900
commit0465c1a7ad5bb797503bc865aae7838b2cf43792 (patch)
treeaa1236560ec3a508d93495b68f7556ea60accb2b /tests/test_domain_py.py
parent8cfea7beddc26c51be08b41a09db1b96afad3d85 (diff)
downloadsphinx-git-0465c1a7ad5bb797503bc865aae7838b2cf43792.tar.gz
Add testcase for modindex_common_prefix
Diffstat (limited to 'tests/test_domain_py.py')
-rw-r--r--tests/test_domain_py.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py
index 947e90d34..178fe18cf 100644
--- a/tests/test_domain_py.py
+++ b/tests/test_domain_py.py
@@ -626,3 +626,26 @@ def test_module_index_not_collapsed(app):
('s', [IndexEntry('sphinx', 0, 'index', 'module-sphinx', '', '', '')])],
True
)
+
+
+@pytest.mark.sphinx(freshenv=True, confoverrides={'modindex_common_prefix': ['sphinx.']})
+def test_modindex_common_prefix(app):
+ text = (".. py:module:: docutils\n"
+ ".. py:module:: sphinx\n"
+ ".. py:module:: sphinx.config\n"
+ ".. py:module:: sphinx.builders\n"
+ ".. py:module:: sphinx.builders.html\n"
+ ".. py:module:: sphinx_intl\n")
+ restructuredtext.parse(app, text)
+ index = PythonModuleIndex(app.env.get_domain('py'))
+ assert index.generate() == (
+ [('b', [IndexEntry('sphinx.builders', 1, 'index', 'module-sphinx.builders', '', '', ''), # NOQA
+ IndexEntry('sphinx.builders.html', 2, 'index', 'module-sphinx.builders.html', '', '', '')]), # NOQA
+ ('c', [IndexEntry('sphinx.config', 0, 'index', 'module-sphinx.config', '', '', '')]),
+ ('d', [IndexEntry('docutils', 0, 'index', 'module-docutils', '', '', '')]),
+ ('s', [IndexEntry('sphinx', 0, 'index', 'module-sphinx', '', '', ''),
+ IndexEntry('sphinx_intl', 0, 'index', 'module-sphinx_intl', '', '', '')])],
+ True
+ )
+
+