diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-04-07 21:09:57 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-04-07 22:39:27 +0900 |
commit | dd6c79476f9606258aa6d7f0ddfcd2db74e8aab2 (patch) | |
tree | 5869d012364e58b3d779631e9ab09d278fa42515 /tests/test_domain_py.py | |
parent | 70ed093b8b45d19beec391def65125a69cb04518 (diff) | |
download | sphinx-git-dd6c79476f9606258aa6d7f0ddfcd2db74e8aab2.tar.gz |
Add PyMethod class; a directive for python method description
Diffstat (limited to 'tests/test_domain_py.py')
-rw-r--r-- | tests/test_domain_py.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py index fb6e70914..4ee3819de 100644 --- a/tests/test_domain_py.py +++ b/tests/test_domain_py.py @@ -290,3 +290,24 @@ def test_pyobject_prefix(app): desc)])])) assert doctree[1][1][1].astext().strip() == 'say' # prefix is stripped assert doctree[1][1][3].astext().strip() == 'FooBar.say' # not stripped + + +def test_pymethod(app): + text = (".. py:class:: Class\n" + "\n" + " .. py:method:: 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 method)', 'Class.meth', '', None)]) + assert_node(doctree[1][1][1], ([desc_signature, ([desc_name, "meth"], + [desc_parameterlist, ()])], + [desc_content, ()])) + assert 'Class.meth' in domain.objects + assert domain.objects['Class.meth'] == ('index', 'method') |