@@ -16,7 +16,7 @@ def SINK(x):
16
16
def test_tuple_with_local_flow ():
17
17
x = (3 , SOURCE )
18
18
y = x [1 ]
19
- SINK (y )
19
+ SINK (y ) # Flow missing
20
20
21
21
# 6.2.1. Identifiers (Names)
22
22
def test_names ():
@@ -42,81 +42,81 @@ def test_floatnumber_literal():
42
42
43
43
def test_imagnumber_literal ():
44
44
x = 42j
45
- SINK (x )
45
+ SINK (x ) # Flow missing
46
46
47
47
# 6.2.3. Parenthesized forms
48
48
def test_parenthesized_form ():
49
49
x = (SOURCE )
50
- SINK (x )
50
+ SINK (x ) # Flow missing
51
51
52
52
# 6.2.5. List displays
53
53
def test_list_display ():
54
54
x = [SOURCE ]
55
- SINK (x [0 ])
55
+ SINK (x [0 ]) # Flow missing
56
56
57
57
def test_list_comprehension ():
58
58
x = [SOURCE for y in [3 ]]
59
- SINK (x [0 ])
59
+ SINK (x [0 ]) # Flow missing
60
60
61
61
def test_nested_list_display ():
62
62
x = [* [SOURCE ]]
63
- SINK (x [0 ])
63
+ SINK (x [0 ]) # Flow missing
64
64
65
65
# 6.2.6. Set displays
66
66
def test_set_display ():
67
67
x = {SOURCE }
68
- SINK (x .pop ())
68
+ SINK (x .pop ()) # Flow missing
69
69
70
70
def test_set_comprehension ():
71
71
x = {SOURCE for y in [3 ]}
72
- SINK (x .pop ())
72
+ SINK (x .pop ()) # Flow missing
73
73
74
74
def test_nested_set_display ():
75
75
x = {* {SOURCE }}
76
- SINK (x .pop ())
76
+ SINK (x .pop ()) # Flow missing
77
77
78
78
# 6.2.7. Dictionary displays
79
79
def test_dict_display ():
80
80
x = {"s" : SOURCE }
81
- SINK (x ["s" ])
81
+ SINK (x ["s" ]) # Flow missing
82
82
83
83
def test_dict_comprehension ():
84
84
x = {y : SOURCE for y in ["s" ]}
85
- SINK (x ["s" ])
85
+ SINK (x ["s" ]) # Flow missing
86
86
87
87
def test_nested_dict_display ():
88
88
x = {** {"s" : SOURCE }}
89
- SINK (x ["s" ])
89
+ SINK (x ["s" ]) # Flow missing
90
90
91
91
# 6.2.8. Generator expressions
92
92
def test_generator ():
93
93
x = (SOURCE for y in [3 ])
94
- SINK ([* x ][0 ])
94
+ SINK ([* x ][0 ]) # Flow missing
95
95
96
96
# 6.2.9. Yield expressions
97
97
def gen (x ):
98
98
yield x
99
99
100
100
def test_yield ():
101
101
g = gen (SOURCE )
102
- SINK (next (g ))
102
+ SINK (next (g )) # Flow missing
103
103
104
104
def gen_from (x ):
105
105
yield from gen (x )
106
106
107
107
def test_yield_from ():
108
108
g = gen_from (SOURCE )
109
- SINK (next (g ))
109
+ SINK (next (g )) # Flow missing
110
110
111
111
# a statement rather than an expression, but related to generators
112
112
def test_for ():
113
113
for x in gen (SOURCE ):
114
- SINK (x )
114
+ SINK (x ) # Flow missing
115
115
116
116
# 6.2.9.1. Generator-iterator methods
117
117
def test___next__ ():
118
118
g = gen (SOURCE )
119
- SINK (g .__next__ ())
119
+ SINK (g .__next__ ()) # Flow missing
120
120
121
121
def gen2 (x ):
122
122
m = yield x # argument of `send` has to flow to value of `yield x` (and so to `m`)
@@ -125,7 +125,7 @@ def gen2(x):
125
125
def test_send ():
126
126
g = gen2 (3 )
127
127
n = next (g )
128
- SINK (g .send (SOURCE ))
128
+ SINK (g .send (SOURCE )) # Flow missing
129
129
130
130
def gen_ex (x ):
131
131
try :
@@ -136,7 +136,7 @@ def gen_ex(x):
136
136
def test_throw ():
137
137
g = gen_ex (SOURCE )
138
138
n = next (g )
139
- SINK (g .throw (TypeError ))
139
+ SINK (g .throw (TypeError )) # Flow missing
140
140
141
141
# no `test_close` as `close` involves no data flow
142
142
@@ -153,7 +153,7 @@ def runa(a):
153
153
154
154
async def atest___anext__ ():
155
155
g = agen (SOURCE )
156
- SINK (await g .__anext__ ())
156
+ SINK (await g .__anext__ ()) # Flow missing
157
157
158
158
def test___anext__ ():
159
159
runa (atest___anext__ ())
@@ -165,7 +165,7 @@ async def agen2(x):
165
165
async def atest_asend ():
166
166
g = agen2 (3 )
167
167
n = await g .__anext__ ()
168
- SINK (await g .asend (SOURCE ))
168
+ SINK (await g .asend (SOURCE )) # Flow missing
169
169
170
170
def test_asend ():
171
171
runa (atest_asend ())
@@ -179,7 +179,7 @@ async def agen_ex(x):
179
179
async def atest_athrow ():
180
180
g = agen_ex (SOURCE )
181
181
n = await g .__anext__ ()
182
- SINK (await g .athrow (TypeError ))
182
+ SINK (await g .athrow (TypeError )) # Flow missing
183
183
184
184
def test_athrow ():
185
185
runa (atest_athrow ())
@@ -189,23 +189,23 @@ class C:
189
189
a = SOURCE
190
190
191
191
def test_attribute_reference ():
192
- SINK (C .a )
192
+ SINK (C .a ) # Flow missing
193
193
194
194
# overriding __getattr__ should be tested by the class coverage tests
195
195
196
196
# 6.3.2. Subscriptions
197
197
# This does not constitute dataflow (but could be taint flow)
198
198
def example_subscription_string ():
199
- SINK ("source" [0 ])
199
+ SINK ("source" [0 ]) # Flow not expected
200
200
201
201
def test_subscription_tuple ():
202
- SINK ((SOURCE ,)[0 ])
202
+ SINK ((SOURCE ,)[0 ]) # Flow missing
203
203
204
204
def test_subscription_list ():
205
- SINK ([SOURCE ][0 ])
205
+ SINK ([SOURCE ][0 ]) # Flow missing
206
206
207
207
def test_subscription_mapping ():
208
- SINK ({"s" :SOURCE }["s" ])
208
+ SINK ({"s" :SOURCE }["s" ]) # Flow missing
209
209
210
210
# overriding __getitem__ should be tested by the class coverage tests
211
211
@@ -214,7 +214,7 @@ def test_subscription_mapping():
214
214
215
215
def test_slicing ():
216
216
s = l [0 :1 :1 ]
217
- SINK (s [0 ])
217
+ SINK (s [0 ]) # Flow missing
218
218
219
219
# The grammar seems to allow `l[0:1:1, 0:1]`, but the interpreter does not like it
220
220
@@ -226,53 +226,55 @@ def test_call_positional():
226
226
SINK (f (3 , SOURCE ))
227
227
228
228
def test_call_keyword ():
229
- SINK (f (3 , b = SOURCE ))
229
+ SINK (f (3 , b = SOURCE )) # Flow missing
230
230
231
231
def test_call_unpack_iterable ():
232
- SINK (f (3 , * [SOURCE ]))
232
+ SINK (f (3 , * [SOURCE ])) # Flow missing
233
233
234
234
def test_call_unpack_mapping ():
235
- SINK (f (3 , ** {"b" : SOURCE }))
235
+ SINK (f (3 , ** {"b" : SOURCE })) # Flow missing
236
236
237
237
def f_extra_pos (a , * b ):
238
238
return b [0 ]
239
239
240
240
def test_call_extra_pos ():
241
- SINK (f_extra_pos (3 , SOURCE ))
241
+ SINK (f_extra_pos (3 , SOURCE )) # Flow missing
242
242
243
243
def f_extra_keyword (a , ** b ):
244
244
return b ["b" ]
245
245
246
246
def test_call_extra_keyword ():
247
- SINK (f_extra_keyword (3 , b = SOURCE ))
247
+ SINK (f_extra_keyword (3 , b = SOURCE )) # Flow missing
248
248
249
249
# return the name of the first extra keyword argument
250
250
def f_extra_keyword_flow (** a ):
251
251
return [* a ][0 ]
252
252
253
253
# call the function with our source as the name of the keyword arguemnt
254
254
def test_call_extra_keyword_flow ():
255
- SINK (f_extra_keyword_flow (** {SOURCE : None }))
255
+ SINK (f_extra_keyword_flow (** {SOURCE : None })) # Flow missing
256
256
257
257
# 6.12. Assignment expressions
258
258
def test_assignment_expression ():
259
259
x = 3
260
- SINK (x := SOURCE )
260
+ SINK (x := SOURCE ) # Flow missing
261
261
262
262
# 6.13. Conditional expressions
263
263
def test_conditional_true ():
264
- SINK (SOURCE if True else 3 )
264
+ SINK (SOURCE if True else 3 ) # Flow missing
265
265
266
266
def test_conditional_false ():
267
- SINK (3 if False else SOURCE )
267
+ SINK (3 if False else SOURCE ) # Flow missing
268
268
269
+ # Condition is evaluated first, so x is SOURCE once chosen
269
270
def test_conditional_evaluation_true ():
270
271
x = 3
271
- SINK (x if (SOURCE == (x := SOURCE )) else 3 ) # Condition is evaluated first, so x is SOURCE once chosen
272
+ SINK (x if (SOURCE == (x := SOURCE )) else 3 ) # Flow missing
272
273
274
+ # Condition is evaluated first, so x is SOURCE once chosen
273
275
def test_conditional_evaluation_false ():
274
276
x = 3
275
- SINK (3 if (3 == (x := SOURCE )) else x ) # Condition is evaluated first, so x is SOURCE once chosen
277
+ SINK (3 if (3 == (x := SOURCE )) else x ) # Flow missing
276
278
277
279
# 6.14. Lambdas
278
280
def test_lambda ():
0 commit comments