diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-06-15 16:45:17 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-15 16:45:17 +0900 |
commit | f6dfab33d29cd389c791acf5821adf556df5ca17 (patch) | |
tree | 07ecbae0a006a51567648553cfaa1f03fe6cbdc4 /tests/test_pycode_parser.py | |
parent | 8fd817d174aed3c6655190f904b89f6f7f2ec099 (diff) | |
parent | 5cf84a5505a6063b48e7fcc4d489259ade526912 (diff) | |
download | sphinx-git-f6dfab33d29cd389c791acf5821adf556df5ca17.tar.gz |
Merge branch '2.0' into refactor_todo2
Diffstat (limited to 'tests/test_pycode_parser.py')
-rw-r--r-- | tests/test_pycode_parser.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_pycode_parser.py b/tests/test_pycode_parser.py index ba9778b80..8f8c6cbab 100644 --- a/tests/test_pycode_parser.py +++ b/tests/test_pycode_parser.py @@ -149,6 +149,21 @@ def test_complex_assignment_py3(): assert parser.definitions == {} +def test_assignment_in_try_clause(): + source = ('try:\n' + ' a = None #: comment\n' + 'except:\n' + ' b = None #: ignored\n' + 'else:\n' + ' c = None #: comment\n') + parser = Parser(source) + parser.parse() + assert parser.comments == {('', 'a'): 'comment', + ('', 'c'): 'comment'} + assert parser.deforders == {'a': 0, + 'c': 1} + + def test_obj_assignment(): source = ('obj = SomeObject() #: some object\n' 'obj.attr = 1 #: attr1\n' |