Skip to content

Commit 62b60f4

Browse files
yoffRasmusWL
andauthored
Apply suggestions from code review
Co-authored-by: Rasmus Wriedt Larsen <[email protected]>
1 parent 0a9515d commit 62b60f4

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

python/ql/test/experimental/dataflow/coverage/test_builtins.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,16 +219,18 @@ def test_dict_pop():
219219
d = {'k': SOURCE}
220220
v = d.pop("k")
221221
SINK(v) #$ flow="SOURCE, l:-2 -> v"
222-
v1 = d.pop("k", SOURCE)
223-
SINK(v1) #$ flow="SOURCE, l:-4 -> v1"
222+
v1 = d.pop("k", NONSOURCE)
223+
SINK_F(v1) #$ SPURIOUS: flow="SOURCE, l:-4 -> v1"
224+
v2 = d.pop("non-existing", SOURCE)
225+
SINK(v2) #$ MISSING: flow="SOURCE, l:-1 -> v2"
224226

225227
@expects(2)
226228
def test_dict_get():
227229
d = {'k': SOURCE}
228230
v = d.get("k")
229231
SINK(v) #$ flow="SOURCE, l:-2 -> v"
230-
v1 = d.get("k", SOURCE)
231-
SINK(v1) #$ flow="SOURCE, l:-4 -> v1"
232+
v1 = d.get("non-existing", SOURCE)
233+
SINK(v1) #$ flow="SOURCE, l:-1 -> v1"
232234

233235
@expects(2)
234236
def test_dict_popitem():
@@ -321,6 +323,13 @@ def test_iter_dict():
321323
l = list(i)
322324
SINK(l[0]) #$ MISSING: flow="SOURCE, l:-3 -> l[0]"
323325

326+
def test_iter_iter():
327+
# applying iter() to the result of iter() is basically a no-op
328+
l0 = [SOURCE]
329+
i = iter(iter(l0))
330+
l = list(i)
331+
SINK(l[0]) #$ MISSING: flow="SOURCE, l:-3 -> l[0]"
332+
324333
### next
325334

326335
def test_next_list():

0 commit comments

Comments
 (0)