summaryrefslogtreecommitdiff
path: root/tests/test_domain_py.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-03-07 23:05:26 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-03-07 23:05:26 +0900
commitdd455fe3d379054a704c97b32c14a992306680b5 (patch)
tree259a1dcd875cbd29fbd865ff68f90e47bc34ce1f /tests/test_domain_py.py
parent0e89979355c6c88adb960a7272c633d5afd34e67 (diff)
downloadsphinx-git-dd455fe3d379054a704c97b32c14a992306680b5.tar.gz
test: Add testcases for decorators
Diffstat (limited to 'tests/test_domain_py.py')
-rw-r--r--tests/test_domain_py.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py
index 218ded510..27819af6b 100644
--- a/tests/test_domain_py.py
+++ b/tests/test_domain_py.py
@@ -585,6 +585,36 @@ def test_pyattribute(app):
assert domain.objects['Class.attr'] == ('index', 'class-attr', 'attribute')
+def test_pydecorator_signature(app):
+ text = ".. py:decorator:: deco"
+ domain = app.env.get_domain('py')
+ doctree = restructuredtext.parse(app, text)
+ assert_node(doctree, (addnodes.index,
+ [desc, ([desc_signature, ([desc_addname, "@"],
+ [desc_name, "deco"])],
+ desc_content)]))
+ assert_node(doctree[1], addnodes.desc, desctype="function",
+ domain="py", objtype="function", noindex=False)
+
+ assert 'deco' in domain.objects
+ assert domain.objects['deco'] == ('index', 'deco', 'function')
+
+
+def test_pydecoratormethod_signature(app):
+ text = ".. py:decoratormethod:: deco"
+ domain = app.env.get_domain('py')
+ doctree = restructuredtext.parse(app, text)
+ assert_node(doctree, (addnodes.index,
+ [desc, ([desc_signature, ([desc_addname, "@"],
+ [desc_name, "deco"])],
+ desc_content)]))
+ assert_node(doctree[1], addnodes.desc, desctype="method",
+ domain="py", objtype="method", noindex=False)
+
+ assert 'deco' in domain.objects
+ assert domain.objects['deco'] == ('index', 'deco', 'method')
+
+
@pytest.mark.sphinx(freshenv=True)
def test_module_index(app):
text = (".. py:module:: docutils\n"