File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
python/ql/test/library-tests/dataflow/coverage Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -257,6 +257,32 @@ def test_yield_from():
257257 SINK (next (g )) # $ MISSING:flow="SOURCE, l:-1 -> next()"
258258
259259
260+ # PEP 798: Unpacking in comprehensions.
261+ # These desugar to `yield from`, so flow depends on yield-from support (see above).
262+ def test_star_list_comp ():
263+ l = [[SOURCE ]]
264+ flat = [* x for x in l ]
265+ SINK (flat [0 ]) # $ MISSING:flow="SOURCE, l:-2 -> flat[0]"
266+
267+
268+ def test_star_set_comp ():
269+ l = [[SOURCE ]]
270+ flat = {* x for x in l }
271+ SINK (flat .pop ()) # $ MISSING:flow="SOURCE, l:-2 -> flat.pop()"
272+
273+
274+ def test_star_genexp ():
275+ l = [[SOURCE ]]
276+ g = (* x for x in l )
277+ SINK (next (g )) # $ MISSING:flow="SOURCE, l:-2 -> next()"
278+
279+
280+ def test_star_dictcomp ():
281+ l = [{"key" : SOURCE }]
282+ merged = {** d for d in l }
283+ SINK (merged ["key" ]) # $ MISSING:flow="SOURCE, l:-2 -> merged[..]"
284+
285+
260286# a statement rather than an expression, but related to generators
261287def test_for ():
262288 for x in gen (SOURCE ):
You can’t perform that action at this time.
0 commit comments