summaryrefslogtreecommitdiff
path: root/tests/test_domain_py.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-04-13 20:25:07 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-04-13 20:26:07 +0900
commit6af38961036dbf05d9ff3c99ab8d39e8b2b5ec2a (patch)
treee013d61ccf885689b33858474f39fa10c45d7efd /tests/test_domain_py.py
parenta337cb793cf067a94f498b8842d7bc3ad96a87b2 (diff)
downloadsphinx-git-6af38961036dbf05d9ff3c99ab8d39e8b2b5ec2a.tar.gz
Add PyFunction and PyVariable; directives for python functions and variables
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 afc34a697..e7ff407bd 100644
--- a/tests/test_domain_py.py
+++ b/tests/test_domain_py.py
@@ -292,6 +292,29 @@ def test_pyobject_prefix(app):
assert doctree[1][1][3].astext().strip() == 'FooBar.say' # not stripped
+def test_pydata(app):
+ text = ".. py:data:: var\n"
+ domain = app.env.get_domain('py')
+ doctree = restructuredtext.parse(app, text)
+ assert_node(doctree, (addnodes.index,
+ [desc, ([desc_signature, desc_name, "var"],
+ [desc_content, ()])]))
+ assert 'var' in domain.objects
+ assert domain.objects['var'] == ('index', 'data')
+
+
+def test_pyfunction(app):
+ text = ".. py:function:: func\n"
+ domain = app.env.get_domain('py')
+ doctree = restructuredtext.parse(app, text)
+ assert_node(doctree, (addnodes.index,
+ [desc, ([desc_signature, ([desc_name, "func"],
+ [desc_parameterlist, ()])],
+ [desc_content, ()])]))
+ assert 'func' in domain.objects
+ assert domain.objects['func'] == ('index', 'function')
+
+
def test_pymethod(app):
text = (".. py:class:: Class\n"
"\n"