summaryrefslogtreecommitdiff
path: root/tests/test_domain_py.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-02-06 22:30:50 +0900
committerGitHub <noreply@github.com>2020-02-06 22:30:50 +0900
commitecf7307023a561418a9199f8f0cf1770424c427a (patch)
tree42f2004a42c1fe5e396024eaf08a7ec1e5314795 /tests/test_domain_py.py
parent0258394d0b9d7c85e78cf31b19ecf46d50aa3ff4 (diff)
parent6b14fcc73110de73956d684ec029bc2628114b79 (diff)
downloadsphinx-git-ecf7307023a561418a9199f8f0cf1770424c427a.tar.gz
Merge branch '2.0' into 6785_attr_can_refer_props
Diffstat (limited to 'tests/test_domain_py.py')
-rw-r--r--tests/test_domain_py.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py
index 913ef8f4b..f78c1e9d8 100644
--- a/tests/test_domain_py.py
+++ b/tests/test_domain_py.py
@@ -286,6 +286,20 @@ def test_exceptions_module_is_ignored(app):
def test_pydata_signature(app):
text = (".. py:data:: version\n"
+ " :type: int\n"
+ " :value: 1\n")
+ doctree = restructuredtext.parse(app, text)
+ assert_node(doctree, (addnodes.index,
+ [desc, ([desc_signature, ([desc_name, "version"],
+ [desc_annotation, ": int"],
+ [desc_annotation, " = 1"])],
+ desc_content)]))
+ assert_node(doctree[1], addnodes.desc, desctype="data",
+ domain="py", objtype="data", noindex=False)
+
+
+def test_pydata_signature_old(app):
+ text = (".. py:data:: version\n"
" :annotation: = 1\n")
doctree = restructuredtext.parse(app, text)
assert_node(doctree, (addnodes.index,
@@ -481,7 +495,9 @@ def test_pystaticmethod(app):
def test_pyattribute(app):
text = (".. py:class:: Class\n"
"\n"
- " .. py:attribute:: attr\n")
+ " .. py:attribute:: attr\n"
+ " :type: str\n"
+ " :value: ''\n")
domain = app.env.get_domain('py')
doctree = restructuredtext.parse(app, text)
assert_node(doctree, (addnodes.index,
@@ -491,7 +507,9 @@ def test_pyattribute(app):
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"],
+ assert_node(doctree[1][1][1], ([desc_signature, ([desc_name, "attr"],
+ [desc_annotation, ": str"],
+ [desc_annotation, " = ''"])],
[desc_content, ()]))
assert 'Class.attr' in domain.objects
assert domain.objects['Class.attr'] == ('index', 'attribute')