Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0cf3fe4

Browse files
committed
Python: Expand dict update tests
1 parent dac2b57 commit 0cf3fe4

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

python/ql/test/experimental/library-tests/CallGraph/InlineCallGraphTest.expected

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pointsTo_found_typeTracker_notFound
1515
| code/func_defined_outside_class.py:39:11:39:21 | ControlFlowNode for _gen() | B._gen |
1616
| code/func_defined_outside_class.py:42:1:42:7 | ControlFlowNode for Attribute() | B._gen.func |
1717
| code/func_defined_outside_class.py:43:1:43:7 | ControlFlowNode for Attribute() | B._gen.func |
18-
| code/func_ref_in_content.py:17:1:17:4 | ControlFlowNode for f2() | func |
18+
| code/func_ref_in_content.py:20:1:20:4 | ControlFlowNode for f2() | func |
1919
| code/funky_regression.py:15:9:15:17 | ControlFlowNode for Attribute() | Wat.f2 |
2020
| code/type_tracking_limitation.py:8:1:8:3 | ControlFlowNode for x() | my_func |
2121
typeTracker_found_pointsTo_notFound
@@ -38,8 +38,10 @@ typeTracker_found_pointsTo_notFound
3838
| code/class_super.py:101:1:101:7 | ControlFlowNode for Attribute() | Z.foo |
3939
| code/class_super.py:108:1:108:8 | ControlFlowNode for Attribute() | Z.foo |
4040
| code/def_in_function.py:22:5:22:11 | ControlFlowNode for Attribute() | test.A.foo |
41-
| code/func_ref_in_content.py:29:1:29:4 | ControlFlowNode for f4() | func |
42-
| code/func_ref_in_content.py:40:1:40:4 | ControlFlowNode for f5() | func |
41+
| code/func_ref_in_content.py:32:1:32:4 | ControlFlowNode for f4() | func |
42+
| code/func_ref_in_content.py:46:1:46:4 | ControlFlowNode for f5() | func |
43+
| code/func_ref_in_content.py:48:1:48:15 | ControlFlowNode for Subscript() | func2 |
44+
| code/func_ref_in_content.py:50:1:50:19 | ControlFlowNode for Subscript() | func2 |
4345
| code/isinstance.py:9:13:9:22 | ControlFlowNode for Attribute() | A.foo |
4446
| code/isinstance.py:9:13:9:22 | ControlFlowNode for Attribute() | ASub.foo |
4547
| code/isinstance.py:14:13:14:22 | ControlFlowNode for Attribute() | A.foo |

python/ql/test/experimental/library-tests/CallGraph/code/func_ref_in_content.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
def func():
22
print("func()")
33

4+
def func2():
5+
print("func2()")
6+
47
def return_func():
58
return func
69

@@ -32,13 +35,20 @@ def return_func_in_dict():
3235
def return_func_in_dict_update():
3336
d = {}
3437
d["func"] = func
38+
d["func2"] = func2
39+
d["contested"] = func
40+
d["contested"] = func2
3541
return d
3642

3743
dct2 = return_func_in_dict_update() # $ pt,tt=return_func_in_dict_update
3844

3945
f5 = dct2['func']
4046
f5() # $ tt=func
4147

48+
dct2['func2']() # $ tt=func2
49+
50+
dct2['contested']() # $ tt=func2 SPURIOUS: tt=func
51+
4252

4353
def return_func_in_list():
4454
return [func, 42]

0 commit comments

Comments
 (0)