mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
Make statement_elements_in_statement work with ListComprehensions, Lambdas and 'except foo as' expressions
This commit is contained in:
@@ -16,6 +16,12 @@ def test_statement_elements_in_statement():
|
||||
p = Parser(string)
|
||||
return helpers.statement_elements_in_statement(p.module.statements[0])
|
||||
|
||||
# list comprehension
|
||||
stmt_els = get_stmt_els('foo = [(bar(f), f) for f in baz]')
|
||||
# stmt_els: count all names: 6; + count all arrays: 2 = 8
|
||||
assert len(stmt_els) == 8
|
||||
|
||||
# lambda
|
||||
stmt_els = get_stmt_els('foo = [lambda x: y]')
|
||||
# stmt_els: count all names: 3; + count all arrays: 1 = 4
|
||||
assert len(stmt_els) == 4
|
||||
|
||||
Reference in New Issue
Block a user