Skip to content

Commit 30b7fad

Browse files
committed
Python: Add test
1 parent 664dac6 commit 30b7fad

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

python/ql/test/experimental/dataflow/fieldflow/test_dict.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ def test_dict_update():
4545
SINK(d["key"]) # $ flow="SOURCE, l:-1 -> d['key']"
4646
SINK(d.get("key")) # $ flow="SOURCE, l:-2 -> d.get(..)"
4747

48+
49+
@expects(2) # $ unresolved_call=expects(..) unresolved_call=expects(..)(..)
50+
def test_dict_update_fresh_key():
51+
# we had a regression where we did not create a dictionary element content
52+
# for keys used in "inline update" like this
53+
d = {}
54+
d["fresh_key"] = SOURCE
55+
SINK(d["fresh_key"]) # $ MISSING: flow="SOURCE, l:-1 -> d['fresh_key']"
56+
57+
4858
@expects(3) # $ unresolved_call=expects(..) unresolved_call=expects(..)(..)
4959
def test_dict_setdefault():
5060
d = {}

0 commit comments

Comments
 (0)