[Zope-Checkins] CVS: Zope/lib/python/RestrictedPython/tests - testRestrictions.py:1.11.6.1

Shane Hathaway shane@digicool.com
Mon, 17 Dec 2001 10:36:38 -0500


Update of /cvs-repository/Zope/lib/python/RestrictedPython/tests
In directory cvs.zope.org:/tmp/cvs-serv32529

Modified Files:
      Tag: Zope-2_5-branch
	testRestrictions.py 
Log Message:
Added test from trunk, but for some reason the printToNone() test fails here.
This needs to be resolved.


=== Zope/lib/python/RestrictedPython/tests/testRestrictions.py 1.11 => 1.11.6.1 ===
 from RestrictedPython import compile_restricted, PrintCollector
 from RestrictedPython.Eval import RestrictionCapableEval
-from RestrictedPython.tests import security_in_syntax
+from RestrictedPython.tests import restricted_module, security_in_syntax
 from types import FunctionType
 
 if __name__=='__main__':
@@ -267,6 +267,16 @@
         v = [12, 34]
         res = expr(m=v)
         assert res == expect
+
+    def checkStackSize(self):
+        for k, rfunc in rmodule.items():
+            if not k.startswith('_') and hasattr(rfunc, 'func_code'):
+                rss = rfunc.func_code.co_stacksize
+                ss = getattr(restricted_module, k).func_code.co_stacksize
+                self.failUnless(
+                    rss >= ss, 'The stack size estimate for %s() '
+                    'should have been at least %d, but was only %d'
+                    % (k, ss, rss))
 
 def test_suite():
     return unittest.makeSuite(RestrictionTests, 'check')