Retrieve all kinds of assignment targets from with test

This commit is contained in:
Batuhan Taskaya
2020-09-24 10:42:56 +03:00
parent 6ae0efa415
commit 606c528803
2 changed files with 11 additions and 2 deletions

View File

@@ -775,8 +775,8 @@ class WithStmt(Flow):
return names
def get_test_node_from_name(self, name):
node = name.parent
if node.type != 'with_item':
node = search_ancestor(name, "with_item")
if node is None:
raise ValueError('The name is not actually part of a with statement.')
return node.children[0]