Add :abstractmethod: option to py:method directive (refs: #6138)

This commit is contained in:
Takeshi KOMIYA
2019-05-15 00:00:51 +09:00
parent af9df449ea
commit 358e582490
4 changed files with 24 additions and 5 deletions
+15 -1
View File
@@ -335,7 +335,9 @@ def test_pymethod_options(app):
" .. py:method:: meth4\n"
" :async:\n"
" .. py:method:: meth5\n"
" :property:\n")
" :property:\n"
" .. py:method:: meth6\n"
" :abstractmethod:\n")
domain = app.env.get_domain('py')
doctree = restructuredtext.parse(app, text)
assert_node(doctree, (addnodes.index,
@@ -350,6 +352,8 @@ def test_pymethod_options(app):
addnodes.index,
desc,
addnodes.index,
desc,
addnodes.index,
desc)])]))
# method
@@ -400,6 +404,16 @@ def test_pymethod_options(app):
assert 'Class.meth5' in domain.objects
assert domain.objects['Class.meth5'] == ('index', 'method')
# :abstractmethod:
assert_node(doctree[1][1][10], addnodes.index,
entries=[('single', 'meth6() (Class method)', 'Class.meth6', '', None)])
assert_node(doctree[1][1][11], ([desc_signature, ([desc_annotation, "abstract "],
[desc_name, "meth6"],
[desc_parameterlist, ()])],
[desc_content, ()]))
assert 'Class.meth6' in domain.objects
assert domain.objects['Class.meth6'] == ('index', 'method')
def test_pyclassmethod(app):
text = (".. py:class:: Class\n"