diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-03-29 01:30:48 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-03-29 19:37:19 +0900 |
commit | ce25d0080ea6090bf14857049516e91419a64ace (patch) | |
tree | a9908fff0eca0d785fee58279c6827a23f5b21fd /tests/test_domain_py.py | |
parent | 7887615374656da0556966b8cd37d2af8dac2654 (diff) | |
download | sphinx-git-ce25d0080ea6090bf14857049516e91419a64ace.tar.gz |
Fix #7219: py:function directive generates incorrect index entry
Diffstat (limited to 'tests/test_domain_py.py')
-rw-r--r-- | tests/test_domain_py.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py index e4bc17004..f3f8bb77d 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=[('single', 'example (module)', '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): |