Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6ba66d0

Browse files
committed
Improved tests; run twice, onece in normal mode, once in restricted mode.
1 parent 880d1ee commit 6ba66d0

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Lib/Bastion.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ def total(self):
141141
return self.sum
142142
o = Original()
143143
b = Bastion(o)
144+
testcode = """if 1:
144145
b.add(81)
145146
b.add(18)
146147
print "b.total() =", b.total()
@@ -156,6 +157,20 @@ def total(self):
156157
print "inaccessible"
157158
else:
158159
print "accessible"
160+
try:
161+
print "b._get_.func_defaults =", b._get_.func_defaults,
162+
except:
163+
print "inaccessible"
164+
else:
165+
print "accessible"
166+
\n"""
167+
exec testcode
168+
print '='*20, "Using rexec:", '='*20
169+
import rexec
170+
r = rexec.RExec()
171+
m = r.add_module('__main__')
172+
m.b = b
173+
r.r_exec(testcode)
159174

160175

161176
if __name__ == '__main__':

0 commit comments

Comments
 (0)