mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Improved tests; run twice, onece in normal mode, once in restricted mode.
This commit is contained in:
parent
880d1eee95
commit
6ba66d0116
1 changed files with 15 additions and 0 deletions
|
|
@ -141,6 +141,7 @@ def _test():
|
||||||
return self.sum
|
return self.sum
|
||||||
o = Original()
|
o = Original()
|
||||||
b = Bastion(o)
|
b = Bastion(o)
|
||||||
|
testcode = """if 1:
|
||||||
b.add(81)
|
b.add(81)
|
||||||
b.add(18)
|
b.add(18)
|
||||||
print "b.total() =", b.total()
|
print "b.total() =", b.total()
|
||||||
|
|
@ -156,6 +157,20 @@ def _test():
|
||||||
print "inaccessible"
|
print "inaccessible"
|
||||||
else:
|
else:
|
||||||
print "accessible"
|
print "accessible"
|
||||||
|
try:
|
||||||
|
print "b._get_.func_defaults =", b._get_.func_defaults,
|
||||||
|
except:
|
||||||
|
print "inaccessible"
|
||||||
|
else:
|
||||||
|
print "accessible"
|
||||||
|
\n"""
|
||||||
|
exec testcode
|
||||||
|
print '='*20, "Using rexec:", '='*20
|
||||||
|
import rexec
|
||||||
|
r = rexec.RExec()
|
||||||
|
m = r.add_module('__main__')
|
||||||
|
m.b = b
|
||||||
|
r.r_exec(testcode)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue