summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pycode_parser.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_pycode_parser.py b/tests/test_pycode_parser.py
index 8b7a945d4..b9327999b 100644
--- a/tests/test_pycode_parser.py
+++ b/tests/test_pycode_parser.py
@@ -9,6 +9,9 @@
:license: BSD, see LICENSE for details.
"""
+import pytest
+from six import PY2
+
from sphinx.pycode.parser import Parser
@@ -116,6 +119,23 @@ def test_complex_assignment():
assert parser.definitions == {}
+@pytest.mark.skipif(PY2, reason='tests for py3 syntax')
+def test_complex_assignment_py3():
+ source = ('a, *b, c = (1, 2, 3, 4) #: unpack assignment\n'
+ 'd, *self.attr = (5, 6, 7) #: unpack assignment2\n'
+ 'e, *f[0] = (8, 9, 0) #: unpack assignment3\n'
+ )
+ parser = Parser(source)
+ parser.parse()
+ assert parser.comments == {('', 'a'): 'unpack assignment',
+ ('', 'b'): 'unpack assignment',
+ ('', 'c'): 'unpack assignment',
+ ('', 'd'): 'unpack assignment2',
+ ('', 'e'): 'unpack assignment3',
+ }
+ assert parser.definitions == {}
+
+
def test_obj_assignment():
source = ('obj = SomeObject() #: some object\n'
'obj.attr = 1 #: attr1\n'