summaryrefslogtreecommitdiff
path: root/tests/test_pycode_parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_pycode_parser.py')
-rw-r--r--tests/test_pycode_parser.py14
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'