summaryrefslogtreecommitdiff
path: root/tests/test_pycode_parser.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2017-10-18 21:35:54 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2017-10-18 21:37:09 +0900
commit4fdcae05843cfc1be155620ade9dff10ab3e9853 (patch)
tree078df6aefcd1913b44d081f1e4e97a9023bf9de1 /tests/test_pycode_parser.py
parent3369d9a03a9f1e173ed3b8281a50f4d52eb39fce (diff)
downloadsphinx-git-4fdcae05843cfc1be155620ade9dff10ab3e9853.tar.gz
Fix #4158: pycode.parser failed to parse starred assignment
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 cfea2ca00..0ff4752b3 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,18 @@ 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'
+ parser = Parser(source)
+ parser.parse()
+ assert parser.comments == {('', 'a'): 'unpack assignment',
+ ('', 'b'): 'unpack assignment',
+ ('', 'c'): 'unpack assignment',
+ }
+ assert parser.definitions == {}
+
+
def test_obj_assignment():
source = ('obj = SomeObject() #: some object\n'
'obj.attr = 1 #: attr1\n'