Skip to content

Commit 09025c2

Browse files
committed
Python: Fix test, update results and annotations
1 parent 6c17304 commit 09025c2

File tree

5 files changed

+85
-51
lines changed

5 files changed

+85
-51
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
| classes.py:620:5:620:16 | SSA variable with_getitem | classes.py:614:15:614:18 | ControlFlowNode for self |
2+
| classes.py:637:5:637:16 | SSA variable with_setitem | classes.py:632:15:632:18 | ControlFlowNode for self |
3+
| classes.py:654:5:654:16 | SSA variable with_delitem | classes.py:649:15:649:18 | ControlFlowNode for self |
4+
| classes.py:735:5:735:12 | SSA variable with_add | classes.py:729:15:729:18 | ControlFlowNode for self |
5+
| classes.py:752:5:752:12 | SSA variable with_sub | classes.py:746:15:746:18 | ControlFlowNode for self |
6+
| classes.py:769:5:769:12 | SSA variable with_mul | classes.py:763:15:763:18 | ControlFlowNode for self |
7+
| classes.py:786:5:786:15 | SSA variable with_matmul | classes.py:780:15:780:18 | ControlFlowNode for self |
8+
| classes.py:803:5:803:16 | SSA variable with_truediv | classes.py:797:15:797:18 | ControlFlowNode for self |
9+
| classes.py:820:5:820:17 | SSA variable with_floordiv | classes.py:814:15:814:18 | ControlFlowNode for self |
10+
| classes.py:837:5:837:12 | SSA variable with_mod | classes.py:831:15:831:18 | ControlFlowNode for self |
11+
| classes.py:877:5:877:12 | SSA variable with_pow | classes.py:865:15:865:18 | ControlFlowNode for self |
12+
| classes.py:894:5:894:15 | SSA variable with_lshift | classes.py:888:15:888:18 | ControlFlowNode for self |
13+
| classes.py:911:5:911:15 | SSA variable with_rshift | classes.py:905:15:905:18 | ControlFlowNode for self |
14+
| classes.py:928:5:928:12 | SSA variable with_and | classes.py:922:15:922:18 | ControlFlowNode for self |
15+
| classes.py:945:5:945:12 | SSA variable with_xor | classes.py:939:15:939:18 | ControlFlowNode for self |
16+
| classes.py:962:5:962:11 | SSA variable with_or | classes.py:956:15:956:18 | ControlFlowNode for self |

python/ql/test/experimental/dataflow/coverage/argumentRouting1.ql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ class ArgumentRoutingConfig extends DataFlow::Configuration {
77
ArgumentRoutingConfig() { this = "ArgumentRoutingConfig" }
88

99
override predicate isSource(DataFlow::Node node) {
10-
exists(AssignmentDefinition def |
10+
exists(AssignmentDefinition def, DataFlow::DataFlowCall call |
1111
def.getVariable() = node.(DataFlow::EssaNode).getVar() and
12-
def.getValue().(DataFlow::DataFlowCall).getCallable().getName().matches("With\\_%")
12+
def.getValue() = call.getNode() and
13+
call.getCallable().getName().matches("With\\_%")
1314
) and
1415
node.(DataFlow::EssaNode).getVar().getName().matches("with\\_%")
1516
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
| classes.py:622:18:622:21 | ControlFlowNode for arg2 | classes.py:613:15:613:17 | ControlFlowNode for key |
2+
| classes.py:640:18:640:21 | ControlFlowNode for arg2 | classes.py:631:15:631:17 | ControlFlowNode for key |
3+
| classes.py:656:22:656:25 | ControlFlowNode for arg2 | classes.py:648:15:648:17 | ControlFlowNode for key |
4+
| classes.py:737:16:737:19 | ControlFlowNode for arg2 | classes.py:728:15:728:19 | ControlFlowNode for other |
5+
| classes.py:754:16:754:19 | ControlFlowNode for arg2 | classes.py:745:15:745:19 | ControlFlowNode for other |
6+
| classes.py:771:16:771:19 | ControlFlowNode for arg2 | classes.py:762:15:762:19 | ControlFlowNode for other |
7+
| classes.py:788:19:788:22 | ControlFlowNode for arg2 | classes.py:779:15:779:19 | ControlFlowNode for other |
8+
| classes.py:805:20:805:23 | ControlFlowNode for arg2 | classes.py:796:15:796:19 | ControlFlowNode for other |
9+
| classes.py:822:22:822:25 | ControlFlowNode for arg2 | classes.py:813:15:813:19 | ControlFlowNode for other |
10+
| classes.py:839:16:839:19 | ControlFlowNode for arg2 | classes.py:830:15:830:19 | ControlFlowNode for other |
11+
| classes.py:879:17:879:20 | ControlFlowNode for arg2 | classes.py:864:15:864:19 | ControlFlowNode for other |
12+
| classes.py:896:20:896:23 | ControlFlowNode for arg2 | classes.py:887:15:887:19 | ControlFlowNode for other |
13+
| classes.py:913:20:913:23 | ControlFlowNode for arg2 | classes.py:904:15:904:19 | ControlFlowNode for other |
14+
| classes.py:930:16:930:19 | ControlFlowNode for arg2 | classes.py:921:15:921:19 | ControlFlowNode for other |
15+
| classes.py:947:16:947:19 | ControlFlowNode for arg2 | classes.py:938:15:938:19 | ControlFlowNode for other |
16+
| classes.py:964:15:964:18 | ControlFlowNode for arg2 | classes.py:955:15:955:19 | ControlFlowNode for other |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| classes.py:640:26:640:29 | ControlFlowNode for arg3 | classes.py:630:15:630:19 | ControlFlowNode for value |

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

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -610,9 +610,9 @@ def test_length_hint():
610610
class With_getitem:
611611

612612
def __getitem__(self, key):
613-
SINK2(key) # Flow not found
614-
SINK1(self) # Flow not found
615-
OK() # Call not found
613+
SINK2(key)
614+
SINK1(self)
615+
OK()
616616
return ""
617617

618618

@@ -627,10 +627,10 @@ def test_getitem():
627627
class With_setitem:
628628

629629
def __setitem__(self, key, value):
630-
SINK3(value) # Flow not found
631-
SINK2(key) # Flow not found
632-
SINK1(self) # Flow not found
633-
OK() # Call not found
630+
SINK3(value)
631+
SINK2(key)
632+
SINK1(self)
633+
OK()
634634

635635

636636
def test_setitem():
@@ -645,9 +645,9 @@ def test_setitem():
645645
class With_delitem:
646646

647647
def __delitem__(self, key):
648-
SINK2(key) # Flow not found
649-
SINK1(self) # Flow not found
650-
OK() # Call not found
648+
SINK2(key)
649+
SINK1(self)
650+
OK()
651651

652652

653653
def test_delitem():
@@ -725,9 +725,9 @@ def test_contains():
725725
class With_add:
726726

727727
def __add__(self, other):
728-
SINK2(other) # Flow not found
729-
SINK1(self) # Flow not found
730-
OK() # Call not found
728+
SINK2(other)
729+
SINK1(self)
730+
OK()
731731
return self
732732

733733

@@ -742,9 +742,9 @@ def test_add():
742742
class With_sub:
743743

744744
def __sub__(self, other):
745-
SINK2(other) # Flow not found
746-
SINK1(self) # Flow not found
747-
OK() # Call not found
745+
SINK2(other)
746+
SINK1(self)
747+
OK()
748748
return self
749749

750750

@@ -759,9 +759,9 @@ def test_sub():
759759
class With_mul:
760760

761761
def __mul__(self, other):
762-
SINK2(other) # Flow not found
763-
SINK1(self) # Flow not found
764-
OK() # Call not found
762+
SINK2(other)
763+
SINK1(self)
764+
OK()
765765
return self
766766

767767

@@ -776,9 +776,9 @@ def test_mul():
776776
class With_matmul:
777777

778778
def __matmul__(self, other):
779-
SINK2(other) # Flow not found
780-
SINK1(self) # Flow not found
781-
OK() # Call not found
779+
SINK2(other)
780+
SINK1(self)
781+
OK()
782782
return self
783783

784784

@@ -793,9 +793,9 @@ def test_matmul():
793793
class With_truediv:
794794

795795
def __truediv__(self, other):
796-
SINK2(other) # Flow not found
797-
SINK1(self) # Flow not found
798-
OK() # Call not found
796+
SINK2(other)
797+
SINK1(self)
798+
OK()
799799
return self
800800

801801

@@ -810,9 +810,9 @@ def test_truediv():
810810
class With_floordiv:
811811

812812
def __floordiv__(self, other):
813-
SINK2(other) # Flow not found
814-
SINK1(self) # Flow not found
815-
OK() # Call not found
813+
SINK2(other)
814+
SINK1(self)
815+
OK()
816816
return self
817817

818818

@@ -827,9 +827,9 @@ def test_floordiv():
827827
class With_mod:
828828

829829
def __mod__(self, other):
830-
SINK2(other) # Flow not found
831-
SINK1(self) # Flow not found
832-
OK() # Call not found
830+
SINK2(other)
831+
SINK1(self)
832+
OK()
833833
return self
834834

835835

@@ -861,9 +861,9 @@ def test_divmod():
861861
class With_pow:
862862

863863
def __pow__(self, other):
864-
SINK2(other) # Flow not found
865-
SINK1(self) # Flow not found
866-
OK() # Call not found
864+
SINK2(other)
865+
SINK1(self)
866+
OK()
867867
return self
868868

869869

@@ -884,9 +884,9 @@ def test_pow_op():
884884
class With_lshift:
885885

886886
def __lshift__(self, other):
887-
SINK2(other) # Flow not found
888-
SINK1(self) # Flow not found
889-
OK() # Call not found
887+
SINK2(other)
888+
SINK1(self)
889+
OK()
890890
return self
891891

892892

@@ -901,9 +901,9 @@ def test_lshift():
901901
class With_rshift:
902902

903903
def __rshift__(self, other):
904-
SINK2(other) # Flow not found
905-
SINK1(self) # Flow not found
906-
OK() # Call not found
904+
SINK2(other)
905+
SINK1(self)
906+
OK()
907907
return self
908908

909909

@@ -918,9 +918,9 @@ def test_rshift():
918918
class With_and:
919919

920920
def __and__(self, other):
921-
SINK2(other) # Flow not found
922-
SINK1(self) # Flow not found
923-
OK() # Call not found
921+
SINK2(other)
922+
SINK1(self)
923+
OK()
924924
return self
925925

926926

@@ -935,9 +935,9 @@ def test_and():
935935
class With_xor:
936936

937937
def __xor__(self, other):
938-
SINK2(other) # Flow not found
939-
SINK1(self) # Flow not found
940-
OK() # Call not found
938+
SINK2(other)
939+
SINK1(self)
940+
OK()
941941
return self
942942

943943

@@ -952,9 +952,9 @@ def test_xor():
952952
class With_or:
953953

954954
def __or__(self, other):
955-
SINK2(other) # Flow not found
956-
SINK1(self) # Flow not found
957-
OK() # Call not found
955+
SINK2(other)
956+
SINK1(self)
957+
OK()
958958
return self
959959

960960

0 commit comments

Comments
 (0)