summaryrefslogtreecommitdiff
path: root/tests/test_domain_py.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-04-07 21:54:19 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-04-07 22:40:08 +0900
commitfcc964b66f9f5e36c0ea023d24e48072b34dfb7d (patch)
tree8ae8faa2612c899c91c0a959b5ee3eeae2698cca /tests/test_domain_py.py
parentc8334705ca27ea3541214db0fd3a8b477b98dcc3 (diff)
downloadsphinx-git-fcc964b66f9f5e36c0ea023d24e48072b34dfb7d.tar.gz
Add PyAttribute class; a directive for python attribute description
Diffstat (limited to 'tests/test_domain_py.py')
-rw-r--r--tests/test_domain_py.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py
index a3836f523..afc34a697 100644
--- a/tests/test_domain_py.py
+++ b/tests/test_domain_py.py
@@ -353,3 +353,22 @@ def test_pystaticmethod(app):
[desc_content, ()]))
assert 'Class.meth' in domain.objects
assert domain.objects['Class.meth'] == ('index', 'staticmethod')
+
+
+def test_pyattribute(app):
+ text = (".. py:class:: Class\n"
+ "\n"
+ " .. py:attribute:: attr\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', 'attr (Class attribute)', 'Class.attr', '', None)])
+ assert_node(doctree[1][1][1], ([desc_signature, desc_name, "attr"],
+ [desc_content, ()]))
+ assert 'Class.attr' in domain.objects
+ assert domain.objects['Class.attr'] == ('index', 'attribute')