summaryrefslogtreecommitdiff
path: root/tests/test_domain_py.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-04-07 21:38:11 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-04-07 22:39:27 +0900
commitc8334705ca27ea3541214db0fd3a8b477b98dcc3 (patch)
tree0a5d2ca7863f8f5fc95722ce30b0b19e6837b91d /tests/test_domain_py.py
parentdd6c79476f9606258aa6d7f0ddfcd2db74e8aab2 (diff)
downloadsphinx-git-c8334705ca27ea3541214db0fd3a8b477b98dcc3.tar.gz
Add PyClassMethod and PyStaticMethod; directives for python method description
Diffstat (limited to 'tests/test_domain_py.py')
-rw-r--r--tests/test_domain_py.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py
index 4ee3819de..a3836f523 100644
--- a/tests/test_domain_py.py
+++ b/tests/test_domain_py.py
@@ -311,3 +311,45 @@ def test_pymethod(app):
[desc_content, ()]))
assert 'Class.meth' in domain.objects
assert domain.objects['Class.meth'] == ('index', 'method')
+
+
+def test_pyclassmethod(app):
+ text = (".. py:class:: Class\n"
+ "\n"
+ " .. py:classmethod:: meth\n")
+ domain = app.env.get_domain('py')
+ doctree = restructuredtext.parse(app, text)
+ assert_node(doctree, (addnodes.index,
+ [desc, ([desc_signature, ([desc_annotation, "class "],
+ [desc_name, "Class"])],
+ [desc_content, (addnodes.index,
+ desc)])]))
+ assert_node(doctree[1][1][0], addnodes.index,
+ entries=[('single', 'meth() (Class class method)', 'Class.meth', '', None)])
+ assert_node(doctree[1][1][1], ([desc_signature, ([desc_annotation, "classmethod "],
+ [desc_name, "meth"],
+ [desc_parameterlist, ()])],
+ [desc_content, ()]))
+ assert 'Class.meth' in domain.objects
+ assert domain.objects['Class.meth'] == ('index', 'classmethod')
+
+
+def test_pystaticmethod(app):
+ text = (".. py:class:: Class\n"
+ "\n"
+ " .. py:staticmethod:: meth\n")
+ domain = app.env.get_domain('py')
+ doctree = restructuredtext.parse(app, text)
+ assert_node(doctree, (addnodes.index,
+ [desc, ([desc_signature, ([desc_annotation, "class "],
+ [desc_name, "Class"])],
+ [desc_content, (addnodes.index,
+ desc)])]))
+ assert_node(doctree[1][1][0], addnodes.index,
+ entries=[('single', 'meth() (Class static method)', 'Class.meth', '', None)])
+ assert_node(doctree[1][1][1], ([desc_signature, ([desc_annotation, "static "],
+ [desc_name, "meth"],
+ [desc_parameterlist, ()])],
+ [desc_content, ()]))
+ assert 'Class.meth' in domain.objects
+ assert domain.objects['Class.meth'] == ('index', 'staticmethod')