diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-04-04 23:12:26 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-04-08 23:51:01 +0900 |
commit | 245e7d7bab6cccc29ae4ef405c8cc81c2845b3a0 (patch) | |
tree | 7dd540e60a0a72c92f2bb3c2c6907edae52f3318 /tests/test_pycode_parser.py | |
parent | 7e1707000feb43b5ea0d1dffe0c5cb1b9dfc268e (diff) | |
download | sphinx-git-245e7d7bab6cccc29ae4ef405c8cc81c2845b3a0.tar.gz |
Fix #4812: autodoc ignores type annotated variables
Diffstat (limited to 'tests/test_pycode_parser.py')
-rw-r--r-- | tests/test_pycode_parser.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_pycode_parser.py b/tests/test_pycode_parser.py index b9327999b..09f1f41f5 100644 --- a/tests/test_pycode_parser.py +++ b/tests/test_pycode_parser.py @@ -9,6 +9,8 @@ :license: BSD, see LICENSE for details. """ +import sys + import pytest from six import PY2 @@ -94,6 +96,18 @@ def test_comment_picker_location(): ('Foo', 'attr3'): 'comment for attr3(3)'} +@pytest.mark.skipif(sys.version_info < (3, 6), reason='tests for py36+ syntax') +def test_annotated_assignment_py36(): + source = ('a: str = "Sphinx" #: comment\n' + 'b: int = 1\n' + '"""string on next line"""') + parser = Parser(source) + parser.parse() + assert parser.comments == {('', 'a'): 'comment', + ('', 'b'): 'string on next line'} + assert parser.definitions == {} + + def test_complex_assignment(): source = ('a = 1 + 1; b = a #: compound statement\n' 'c, d = (1, 1) #: unpack assignment\n' |