Add a test for doc on coroutine functions and general support for async/await py3.5 syntax

This commit is contained in:
Alberto Berti
2015-11-10 02:32:19 +01:00
parent 1172d1dba2
commit 933ed5a50c
2 changed files with 19 additions and 2 deletions

View File

@@ -97,8 +97,7 @@ shift_expr: arith_expr (('<<'|'>>') arith_expr)*
arith_expr: term (('+'|'-') term)*
term: factor (('*'|'@'|'/'|'%'|'//') factor)*
factor: ('+'|'-'|'~') factor | power
power: atom_expr ['**' factor]
atom_expr: [AWAIT] atom trailer*
power: [AWAIT] atom trailer* ['**' factor]
atom: ('(' [yield_expr|testlist_comp] ')' |
'[' [testlist_comp] ']' |
'{' [dictorsetmaker] '}' |

View File

@@ -636,6 +636,10 @@ def test_generate():
('attribute', 'test_autodoc.Class.inst_attr_string'),
('method', 'test_autodoc.Class.moore'),
])
if six.PY3 and sys.version_info[:2] >= (3, 5):
should.extend([
('method', 'test_autodoc.Class.do_coroutine'),
])
options.members = ALL
assert_processes(should, 'class', 'Class')
options.undoc_members = True
@@ -791,6 +795,7 @@ def test_generate():
'module', 'test_autodoc')
# --- generate fodder ------------
import six, sys
__all__ = ['Class']
@@ -833,6 +838,12 @@ class Base(object):
def inheritedmeth(self):
"""Inherited function."""
if six.PY3 and sys.version_info[:2] >= (3, 5):
async def _other_coro_func():
return "run"
class Class(Base):
"""Class to document."""
@@ -889,6 +900,13 @@ class Class(Base):
# undocumented special method
pass
if six.PY3 and sys.version_info[:2] >= (3, 5):
async def do_coroutine(self):
"""A documented coroutine function"""
attr_coro_result = await _other_coro_func()
class CustomDict(dict):
"""Docstring."""