summaryrefslogtreecommitdiff
path: root/tests/test_pycode_parser.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-04-13 23:08:52 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-04-23 01:40:37 +0900
commita77613fcfaf1323a46ba5645cc5569da7457d2fa (patch)
treef08ef974764f743d3689a17cbcf4ab447e0a2b1b /tests/test_pycode_parser.py
parente0abb107929df0d2e97daa7cddeda1e7b4763d60 (diff)
downloadsphinx-git-a77613fcfaf1323a46ba5645cc5569da7457d2fa.tar.gz
pycode: Support "async" syntax
Diffstat (limited to 'tests/test_pycode_parser.py')
-rw-r--r--tests/test_pycode_parser.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_pycode_parser.py b/tests/test_pycode_parser.py
index 403c918dc..ba9778b80 100644
--- a/tests/test_pycode_parser.py
+++ b/tests/test_pycode_parser.py
@@ -314,6 +314,21 @@ def test_decorators():
'Foo.method': ('def', 13, 15)}
+def test_async_function_and_method():
+ source = ('async def some_function():\n'
+ ' """docstring"""\n'
+ ' a = 1 + 1 #: comment1\n'
+ '\n'
+ 'class Foo:\n'
+ ' async def method(self):\n'
+ ' pass\n')
+ parser = Parser(source)
+ parser.parse()
+ assert parser.definitions == {'some_function': ('def', 1, 3),
+ 'Foo': ('class', 5, 7),
+ 'Foo.method': ('def', 6, 7)}
+
+
def test_formfeed_char():
source = ('class Foo:\n'
'\f\n'