summaryrefslogtreecommitdiff
path: root/tests/test_domain_py.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-03-29 20:04:29 +0900
committerGitHub <noreply@github.com>2020-03-29 20:04:29 +0900
commit70c61e44c34b4dadf1a7552be7c5feabd74b98bc (patch)
tree75df1e16faa935738bc293085d52d748b24727fe /tests/test_domain_py.py
parent7887615374656da0556966b8cd37d2af8dac2654 (diff)
parentfe9473f42e71db5fca3281ecd09f0a39f5683385 (diff)
downloadsphinx-git-70c61e44c34b4dadf1a7552be7c5feabd74b98bc.tar.gz
Merge pull request #7395 from tk0miya/7219_indexentries_for_pyfunc
Fix #7219: py:function directive generates incorrect index entry
Diffstat (limited to 'tests/test_domain_py.py')
-rw-r--r--tests/test_domain_py.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py
index e4bc17004..0d7a65edb 100644
--- a/tests/test_domain_py.py
+++ b/tests/test_domain_py.py
@@ -461,6 +461,7 @@ def test_pydata(app):
def test_pyfunction(app):
text = (".. py:function:: func1\n"
+ ".. py:module:: example\n"
".. py:function:: func2\n"
" :async:\n")
domain = app.env.get_domain('py')
@@ -469,15 +470,25 @@ def test_pyfunction(app):
[desc, ([desc_signature, ([desc_name, "func1"],
[desc_parameterlist, ()])],
[desc_content, ()])],
+ nodes.target,
+ addnodes.index,
addnodes.index,
[desc, ([desc_signature, ([desc_annotation, "async "],
+ [desc_addname, "example."],
[desc_name, "func2"],
[desc_parameterlist, ()])],
[desc_content, ()])]))
+ assert_node(doctree[0], addnodes.index,
+ entries=[('pair', 'built-in function; func1()', 'func1', '', None)])
+ assert_node(doctree[3], addnodes.index,
+ entries=[('pair', 'module; example', 'module-example', '', None)])
+ assert_node(doctree[4], addnodes.index,
+ entries=[('single', 'func2() (in module example)', 'example.func2', '', None)])
+
assert 'func1' in domain.objects
assert domain.objects['func1'] == ('index', 'func1', 'function')
- assert 'func2' in domain.objects
- assert domain.objects['func2'] == ('index', 'func2', 'function')
+ assert 'example.func2' in domain.objects
+ assert domain.objects['example.func2'] == ('index', 'example.func2', 'function')
def test_pymethod_options(app):