2
# tag: control-flow, uninitialized
8
>>> conditional(False) # doctest: +ELLIPSIS
9
Traceback (most recent call last):
11
UnboundLocalError: ...local variable 'a'...
19
>>> inside_loop([1,2,3])
21
>>> inside_loop([]) # doctest: +ELLIPSIS
22
Traceback (most recent call last):
24
UnboundLocalError: ...local variable 'i'...
34
>>> try_except(False) # doctest: +ELLIPSIS
35
Traceback (most recent call last):
37
UnboundLocalError: ...local variable 'a'...
50
>>> try_finally(False) # doctest: +ELLIPSIS
51
Traceback (most recent call last):
53
UnboundLocalError: ...local variable 'a'...
66
>>> deleted(True) # doctest: +ELLIPSIS
67
Traceback (most recent call last):
69
UnboundLocalError: ...local variable 'a'...
79
>>> test_nested(False) # doctest: +ELLIPSIS
80
Traceback (most recent call last):
82
UnboundLocalError: ...local variable 'a'...
93
>>> test_outer(False) # doctest: +ELLIPSIS
94
Traceback (most recent call last):
96
UnboundLocalError: ...local variable 'a'...
108
>>> test_inner(False) # doctest: +ELLIPSIS
109
Traceback (most recent call last):
111
NameError: ...free variable 'a' ... in enclosing scope
123
>>> test_class(False) # doctest: +ELLIPSIS
124
Traceback (most recent call last):
126
UnboundLocalError: ...local variable 'A'...
134
def test_try_except_regression(c):
136
>>> test_try_except_regression(True)
138
>>> test_try_except_regression(False) # doctest: +ELLIPSIS
139
Traceback (most recent call last):
141
UnboundLocalError: ...local variable 'a'...
151
def test_try_finally_regression(c):
153
>>> test_try_finally_regression(True)
155
>>> test_try_finally_regression(False) # doctest: +ELLIPSIS
156
Traceback (most recent call last):
158
UnboundLocalError: ...local variable 'a'...
168
def test_expression_calculation_order_bug(a):
170
>>> test_expression_calculation_order_bug(False)
172
>>> test_expression_calculation_order_bug(True) # doctest: +ELLIPSIS
173
Traceback (most recent call last):
175
UnboundLocalError: ...local variable 'b'...
179
return (a or b) and (b or a)