mirror of
https://github.com/davidhalter/parso.git
synced 2026-10-01 15:33:46 +08:00
Retrieve all kinds of assignment targets from with test
This commit is contained in:
1 parent
6ae0efa415
commit
606c528803
2 files changed
+11
-2
No files matched your search
@@ -229,3 +229,12 @@ def test_iter_funcdefs():
|
||||
module = parse(code, version='3.8')
|
||||
func_names = [f.name.value for f in module.iter_funcdefs()]
|
||||
assert func_names == ['normal', 'asyn', 'dec_normal', 'dec_async']
|
||||
|
||||
def test_with_stmt_get_test_node_from_name():
|
||||
code = "with A as X.Y, B as (Z), C as Q[0], D as Q['foo']: pass"
|
||||
with_stmt = parse(code, version='3').children[0]
|
||||
tests = [
|
||||
with_stmt.get_test_node_from_name(name).value
|
||||
for name in with_stmt.get_defined_names(include_setitem=True)
|
||||
]
|
||||
assert tests == ["A", "B", "C", "D"]
|
||||
Reference in new issue
Block a user