-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy patha.py
More file actions
52 lines (34 loc) · 829 Bytes
/
a.py
File metadata and controls
52 lines (34 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
a = 'a.a'
def f():
return 'a.f()'
def g():
return 'a.g()'
class C:
def m(self):
return 'a.C.m()'
#imports on child and stuff defined in the import are not passed to parent
import imported_from_a
assert imported_from_a.n == 1
##__name__
#it is visible to the imported file
#assuming this was imported from .main:
#assert __name__ == 'a'
#assuming this was imported as
#b = imp.load_source('c','a.py')
#from .main:
#assert __name__ == 'c'
#imports from the importing file are not put into this namespace
try:
imported_from_main.f()
except NameError:
pass
else:
assert False
# This does not work:
def __call__():
return "a.__call__()"
import sys
syspath = sys.path
import contains_list
print 'contains_list.l = ' + str(contains_list.l)
assert contains_list.l == [1]