blob: b87b8b27bae30c328d2569180240711b06cf2b50 [file] [log] [blame]
Tor Norbye3a2425a2013-11-04 10:16:08 -08001global_foo = 1
2
3
4def test_outer_function():
5 foo = 1
6 def bar():
7 <weak_warning descr="Shadows name 'foo' from outer scope">foo</weak_warning>, <weak_warning descr="Shadows name 'bar' from outer scope">bar</weak_warning> = 1, 2
8 def baz(<weak_warning descr="Shadows name 'foo' from outer scope">foo</weak_warning>, <weak_warning descr="Shadows name 'bar' from outer scope">bar</weak_warning>, <weak_warning descr="Shadows name 'baz' from outer scope">baz</weak_warning>):
9 pass
10 def nested():
11 def <weak_warning descr="Shadows name 'baz' from outer scope">baz</weak_warning>(<weak_warning descr="Shadows name 'foo' from outer scope">foo</weak_warning>):
12 <weak_warning descr="Shadows name 'bar' from outer scope">bar</weak_warning> = 1
13
14
15def test_outer_class():
16 baz = 1
17 quux = 2
18 spam = 3
19 class C(object):
20 def foo(self):
21 def foo():
22 def <weak_warning descr="Shadows name 'bar' from outer scope">bar</weak_warning>():
23 class <weak_warning descr="Shadows name 'C' from outer scope">C</weak_warning>:
24 def baz(self):
25 pass
26 def bar():
27 pass
28
29 <weak_warning descr="Shadows name 'baz' from outer scope">baz</weak_warning> = 2
30
31 def spam(self):
32 pass
33
34 quux = 1
35
36
37def test_outer_global():
38 global global_foo
39 global_foo = 2
40
41
42def test_outer_comprehensions():
43 print(x for x in range(10))
44 print([y for y in range(10)])
45 def f(x, <weak_warning descr="Shadows name 'y' from outer scope">y</weak_warning>):
46 pass