Skip to content

Commit 5bbf932

Browse files
committed
Python: Add test for tuple unpacking with "complicated" value.
1 parent 7a3895d commit 5bbf932

9 files changed

Lines changed: 40 additions & 0 deletions

File tree

python/ql/test/library-tests/PointsTo/new/Dataflow.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
| a_simple.py:49 | g_0 = a |
6363
| a_simple.py:49 | h_0 = b |
6464
| a_simple.py:49 | i_0 = c |
65+
| a_simple.py:53 | l_0 = BinaryExpr[0] |
66+
| a_simple.py:53 | m_0 = BinaryExpr[1] |
6567
| b_condition.py:0 | __name___0 = ScopeEntryDefinition |
6668
| b_condition.py:0 | __package___0 = ScopeEntryDefinition |
6769
| b_condition.py:0 | double_attr_check_0 = ScopeEntryDefinition |

python/ql/test/library-tests/PointsTo/new/Definitions.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
| a_simple.py:49 | Local Variable g | AssignmentDefinition |
4646
| a_simple.py:49 | Local Variable h | AssignmentDefinition |
4747
| a_simple.py:49 | Local Variable i | AssignmentDefinition |
48+
| a_simple.py:53 | Local Variable l | MultiAssignmentDefinition |
49+
| a_simple.py:53 | Local Variable m | MultiAssignmentDefinition |
4850
| b_condition.py:0 | Global Variable __name__ | ScopeEntryDefinition |
4951
| b_condition.py:0 | Global Variable __package__ | ScopeEntryDefinition |
5052
| b_condition.py:0 | Global Variable double_attr_check | ScopeEntryDefinition |

python/ql/test/library-tests/PointsTo/new/PointsToWithContext.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
6868
| a_simple.py:49 | ControlFlowNode for i | 'c' | builtin-class str | 38 | runtime |
6969
| a_simple.py:51 | ControlFlowNode for h | 'b' | builtin-class str | 38 | runtime |
7070
| a_simple.py:52 | ControlFlowNode for i | 'c' | builtin-class str | 38 | runtime |
71+
| a_simple.py:53 | ControlFlowNode for BinaryExpr | BinaryExpr | builtin-class tuple | 53 | runtime |
72+
| a_simple.py:53 | ControlFlowNode for IntegerLiteral | int 1 | builtin-class int | 53 | runtime |
73+
| a_simple.py:53 | ControlFlowNode for IntegerLiteral | int 2 | builtin-class int | 53 | runtime |
74+
| a_simple.py:53 | ControlFlowNode for Tuple | BinaryExpr | builtin-class tuple | 53 | runtime |
75+
| a_simple.py:53 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 53 | runtime |
76+
| a_simple.py:54 | ControlFlowNode for l | l | builtin-class object | 53 | runtime |
77+
| a_simple.py:55 | ControlFlowNode for m | m | builtin-class object | 53 | runtime |
7178
| b_condition.py:4 | ControlFlowNode for FunctionExpr | Function f | builtin-class function | 4 | import |
7279
| b_condition.py:4 | ControlFlowNode for f | Function f | builtin-class function | 4 | import |
7380
| b_condition.py:5 | ControlFlowNode for IfExp | NoneType None | builtin-class NoneType | 5 | runtime |

python/ql/test/library-tests/PointsTo/new/PointsToWithType.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ WARNING: Predicate points_to has been deprecated and may be removed in future (P
6868
| a_simple.py:49 | ControlFlowNode for i | 'c' | builtin-class str | 38 |
6969
| a_simple.py:51 | ControlFlowNode for h | 'b' | builtin-class str | 38 |
7070
| a_simple.py:52 | ControlFlowNode for i | 'c' | builtin-class str | 38 |
71+
| a_simple.py:53 | ControlFlowNode for BinaryExpr | BinaryExpr | builtin-class tuple | 53 |
72+
| a_simple.py:53 | ControlFlowNode for IntegerLiteral | int 1 | builtin-class int | 53 |
73+
| a_simple.py:53 | ControlFlowNode for IntegerLiteral | int 2 | builtin-class int | 53 |
74+
| a_simple.py:53 | ControlFlowNode for Tuple | BinaryExpr | builtin-class tuple | 53 |
75+
| a_simple.py:53 | ControlFlowNode for Tuple | Tuple | builtin-class tuple | 53 |
76+
| a_simple.py:54 | ControlFlowNode for l | l | builtin-class object | 53 |
77+
| a_simple.py:55 | ControlFlowNode for m | m | builtin-class object | 53 |
7178
| b_condition.py:4 | ControlFlowNode for FunctionExpr | Function f | builtin-class function | 4 |
7279
| b_condition.py:4 | ControlFlowNode for f | Function f | builtin-class function | 4 |
7380
| b_condition.py:5 | ControlFlowNode for IfExp | NoneType None | builtin-class NoneType | 5 |

python/ql/test/library-tests/PointsTo/new/SourceNodeDefinitions.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
| a_simple.py:38 | Local Variable g | Entry node for Function multi_assign_and_packing | definition |
4747
| a_simple.py:38 | Local Variable h | Entry node for Function multi_assign_and_packing | definition |
4848
| a_simple.py:38 | Local Variable i | Entry node for Function multi_assign_and_packing | definition |
49+
| a_simple.py:38 | Local Variable l | Entry node for Function multi_assign_and_packing | definition |
50+
| a_simple.py:38 | Local Variable m | Entry node for Function multi_assign_and_packing | definition |
4951
| a_simple.py:38 | Local Variable p | Entry node for Function multi_assign_and_packing | definition |
5052
| a_simple.py:38 | Local Variable q | Entry node for Function multi_assign_and_packing | definition |
5153
| a_simple.py:38 | Local Variable r | Entry node for Function multi_assign_and_packing | definition |
@@ -65,6 +67,8 @@
6567
| a_simple.py:49 | Local Variable g | ControlFlowNode for g | definition |
6668
| a_simple.py:49 | Local Variable h | ControlFlowNode for h | definition |
6769
| a_simple.py:49 | Local Variable i | ControlFlowNode for i | definition |
70+
| a_simple.py:53 | Local Variable l | ControlFlowNode for l | definition |
71+
| a_simple.py:53 | Local Variable m | ControlFlowNode for m | definition |
6872
| b_condition.py:0 | Global Variable __name__ | Entry node for Module code.b_condition | definition |
6973
| b_condition.py:0 | Global Variable __package__ | Entry node for Module code.b_condition | definition |
7074
| b_condition.py:0 | Global Variable double_attr_check | Entry node for Module code.b_condition | definition |

python/ql/test/library-tests/PointsTo/new/SsaUses.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
| a_simple.py:38 | g_0 | Exit node for Function multi_assign_and_packing |
6363
| a_simple.py:38 | h_0 | Exit node for Function multi_assign_and_packing |
6464
| a_simple.py:38 | i_0 | Exit node for Function multi_assign_and_packing |
65+
| a_simple.py:38 | l_0 | Exit node for Function multi_assign_and_packing |
66+
| a_simple.py:38 | m_0 | Exit node for Function multi_assign_and_packing |
6567
| a_simple.py:38 | p_0 | Exit node for Function multi_assign_and_packing |
6668
| a_simple.py:38 | q_0 | Exit node for Function multi_assign_and_packing |
6769
| a_simple.py:38 | r_0 | Exit node for Function multi_assign_and_packing |
@@ -87,6 +89,8 @@
8789
| a_simple.py:50 | g_0 | ControlFlowNode for g |
8890
| a_simple.py:51 | h_0 | ControlFlowNode for h |
8991
| a_simple.py:52 | i_0 | ControlFlowNode for i |
92+
| a_simple.py:54 | l_0 | ControlFlowNode for l |
93+
| a_simple.py:55 | m_0 | ControlFlowNode for m |
9094
| b_condition.py:0 | __name___0 | Exit node for Module code.b_condition |
9195
| b_condition.py:0 | __package___0 | Exit node for Module code.b_condition |
9296
| b_condition.py:0 | double_attr_check_1 | Exit node for Module code.b_condition |

python/ql/test/library-tests/PointsTo/new/Values.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@
5454
| a_simple.py:49 | ControlFlowNode for c | runtime | 'c' | builtin-class str |
5555
| a_simple.py:51 | ControlFlowNode for h | runtime | 'b' | builtin-class str |
5656
| a_simple.py:52 | ControlFlowNode for i | runtime | 'c' | builtin-class str |
57+
| a_simple.py:53 | ControlFlowNode for BinaryExpr | runtime | instance of tuple | builtin-class tuple |
58+
| a_simple.py:53 | ControlFlowNode for IntegerLiteral | runtime | int 1 | builtin-class int |
59+
| a_simple.py:53 | ControlFlowNode for IntegerLiteral | runtime | int 2 | builtin-class int |
60+
| a_simple.py:53 | ControlFlowNode for Tuple | runtime | (int 1, ) | builtin-class tuple |
61+
| a_simple.py:53 | ControlFlowNode for Tuple | runtime | (int 2, ) | builtin-class tuple |
62+
| a_simple.py:54 | ControlFlowNode for l | runtime | instance of object | builtin-class object |
63+
| a_simple.py:55 | ControlFlowNode for m | runtime | instance of object | builtin-class object |
5764
| b_condition.py:4 | ControlFlowNode for FunctionExpr | import | Function f | builtin-class function |
5865
| b_condition.py:5 | ControlFlowNode for IfExp | runtime | None | builtin-class NoneType |
5966
| b_condition.py:5 | ControlFlowNode for None | runtime | None | builtin-class NoneType |

python/ql/test/library-tests/PointsTo/new/VarUses.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
| a_simple.py:38 | g | Exit node for Function multi_assign_and_packing |
4848
| a_simple.py:38 | h | Exit node for Function multi_assign_and_packing |
4949
| a_simple.py:38 | i | Exit node for Function multi_assign_and_packing |
50+
| a_simple.py:38 | l | Exit node for Function multi_assign_and_packing |
51+
| a_simple.py:38 | m | Exit node for Function multi_assign_and_packing |
5052
| a_simple.py:38 | p | Exit node for Function multi_assign_and_packing |
5153
| a_simple.py:38 | q | Exit node for Function multi_assign_and_packing |
5254
| a_simple.py:38 | r | Exit node for Function multi_assign_and_packing |
@@ -72,6 +74,8 @@
7274
| a_simple.py:50 | g | ControlFlowNode for g |
7375
| a_simple.py:51 | h | ControlFlowNode for h |
7476
| a_simple.py:52 | i | ControlFlowNode for i |
77+
| a_simple.py:54 | l | ControlFlowNode for l |
78+
| a_simple.py:55 | m | ControlFlowNode for m |
7579
| b_condition.py:0 | Exception | Exit node for Module code.b_condition |
7680
| b_condition.py:0 | TypeError | Exit node for Module code.b_condition |
7781
| b_condition.py:0 | __name__ | Exit node for Module code.b_condition |

python/ql/test/library-tests/PointsTo/new/code/a_simple.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ def multi_assign_and_packing(a, b="b", c="c"):
5050
g
5151
h
5252
i
53+
l, m = (1,) + (2,)
54+
l
55+
m

0 commit comments

Comments
 (0)