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

Skip to content

Commit 1d269b0

Browse files
committed
Python: Add extra test for pruning.
1 parent 00fa803 commit 1d269b0

2 files changed

Lines changed: 117 additions & 0 deletions

File tree

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
| 8 | test | test | Truthy |
2+
| 10 | test | test | Truthy |
3+
| 14 | seq | seq | Truthy |
4+
| 16 | seq | seq | Truthy |
5+
| 17 | seq | seq | Truthy |
6+
| 21 | UnaryExpr | t1 | Falsey |
7+
| 21 | t1 | t1 | Truthy |
8+
| 24 | t1 | t1 | Truthy |
9+
| 25 | t1 | t1 | Truthy |
10+
| 26 | t2 | t2 | Truthy |
11+
| 29 | t2 | t2 | Truthy |
12+
| 30 | t2 | t2 | Truthy |
13+
| 31 | t3 | t3 | Truthy |
14+
| 31 | t4 | t4 | Truthy |
15+
| 32 | t3 | t3 | Truthy |
16+
| 33 | t3 | t3 | Truthy |
17+
| 34 | t3 | t3 | Truthy |
18+
| 35 | t4 | t4 | Truthy |
19+
| 36 | t5 | t5 | Truthy |
20+
| 36 | t6 | t6 | Truthy |
21+
| 37 | t5 | t5 | Truthy |
22+
| 38 | t5 | t5 | Truthy |
23+
| 39 | t6 | t6 | Truthy |
24+
| 40 | t6 | t6 | Truthy |
25+
| 43 | t1 | t1 | Truthy |
26+
| 44 | UnaryExpr | t2 | Falsey |
27+
| 44 | t2 | t2 | Truthy |
28+
| 47 | t1 | t1 | Truthy |
29+
| 48 | t2 | t2 | Truthy |
30+
| 49 | t2 | t2 | Truthy |
31+
| 51 | t2 | t2 | Truthy |
32+
| 52 | t2 | t2 | Truthy |
33+
| 55 | seq1 | seq1 | Truthy |
34+
| 57 | UnaryExpr | seq2 | Falsey |
35+
| 57 | seq2 | seq2 | Truthy |
36+
| 60 | seq1 | seq1 | Truthy |
37+
| 62 | seq1 | seq1 | Truthy |
38+
| 63 | seq2 | seq2 | Truthy |
39+
| 65 | seq2 | seq2 | Truthy |
40+
| 66 | seq3 | seq3 | Truthy |
41+
| 68 | UnaryExpr | seq4 | Falsey |
42+
| 68 | seq4 | seq4 | Truthy |
43+
| 71 | seq3 | seq3 | Truthy |
44+
| 73 | var | var | Truthy |
45+
| 74 | seq4 | seq4 | Truthy |
46+
| 76 | var | var | Truthy |
47+
| 78 | seq5 | seq5 | Truthy |
48+
| 80 | seq5 | seq5 | Truthy |
49+
| 81 | seq5 | seq5 | Truthy |
50+
| 83 | var | var | Truthy |
51+
| 88 | UnaryExpr | x | Falsey |
52+
| 88 | x | x | Truthy |
53+
| 89 | Exception | Exception | Truthy |
54+
| 90 | y | y | Truthy |
55+
| 91 | Exception | Exception | Truthy |
56+
| 92 | make_a_call | make_a_call | Truthy |
57+
| 93 | UnaryExpr | x | Falsey |
58+
| 93 | x | x | Truthy |
59+
| 94 | count | count | Truthy |
60+
| 95 | y | y | Truthy |
61+
| 96 | count | count | Truthy |
62+
| 101 | make_a_call | make_a_call | Truthy |
63+
| 102 | UnaryExpr | another_module | Falsey |
64+
| 102 | another_module | another_module | Truthy |
65+
| 103 | count | count | Truthy |
66+
| 107 | UnaryExpr | t1 | Falsey |
67+
| 107 | t1 | t1 | Truthy |
68+
| 109 | t2 | t2 | Truthy |
69+
| 111 | t1 | t1 | Truthy |
70+
| 113 | UnaryExpr | t2 | Falsey |
71+
| 113 | t2 | t2 | Truthy |
72+
| 117 | UnaryExpr | test | Falsey |
73+
| 117 | test | test | Truthy |
74+
| 119 | UnaryExpr | test | Falsey |
75+
| 119 | test | test | Truthy |
76+
| 123 | m | m | Truthy |
77+
| 125 | m | m | Truthy |
78+
| 126 | m | m | Truthy |
79+
| 158 | Compare | ps | Is not None |
80+
| 158 | ps | ps | Truthy |
81+
| 159 | ps | ps | Truthy |
82+
| 160 | Compare | ps | Is None |
83+
| 160 | ps | ps | Truthy |
84+
| 171 | __name__ | __name__ | Truthy |
85+
| 172 | None | None | Truthy |
86+
| 174 | func | func | Truthy |
87+
| 175 | Exception | Exception | Truthy |
88+
| 176 | count | count | Truthy |
89+
| 177 | Compare | escapes | Is None |
90+
| 177 | None | None | Truthy |
91+
| 177 | escapes | escapes | Truthy |
92+
| 178 | count | count | Truthy |
93+
| 180 | count | count | Truthy |
94+
| 188 | true12 | true12 | Truthy |
95+
| 195 | Compare | x | < 4 |
96+
| 195 | x | x | Truthy |
97+
| 197 | Compare | x | < 4 |
98+
| 197 | x | x | Truthy |
99+
| 201 | Compare | x | < 4 |
100+
| 201 | x | x | Truthy |
101+
| 203 | Compare | x | >= 4 |
102+
| 203 | UnaryExpr | x | < 4 |
103+
| 203 | x | x | Truthy |
104+
| 207 | Compare | x | < 4 |
105+
| 207 | x | x | Truthy |
106+
| 209 | Compare | x | < 4 |
107+
| 209 | x | x | Truthy |
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
import python
3+
4+
import semmle.python.Pruning
5+
6+
from Pruner::Constraint c, SsaVariable var, Pruner::UnprunedCfgNode node, int line
7+
where c = Pruner::constraintFromTest(var, node) and line = node.getNode().getLocation().getStartLine() and
8+
line > 0
9+
select line, node.getNode().toString(), var.getId(), c
10+

0 commit comments

Comments
 (0)