[Zope-Checkins] CVS: Zope2 - testRestrictions.py:1.1.2.3

shane@digicool.com shane@digicool.com
Wed, 25 Apr 2001 16:25:27 -0400 (EDT)


Update of /cvs-repository/Zope2/lib/python/RestrictedPython/tests
In directory korak:/tmp/cvs-serv27164/tests

Modified Files:
      Tag: RestrictedPythonBranch
	testRestrictions.py 
Log Message:
Added test of RestrictionCapableEval



--- Updated File testRestrictions.py in package Zope2 --
--- testRestrictions.py	2001/04/25 02:51:31	1.1.2.2
+++ testRestrictions.py	2001/04/25 20:25:25	1.1.2.3
@@ -7,6 +7,7 @@
 
 import unittest
 from RestrictedPython import compile_restricted, PrintCollector
+from RestrictedPython.Eval import RestrictionCapableEval
 import security_in_syntax
 
 def package_home(globals_dict):
@@ -232,6 +233,16 @@
         res = self.execFunc('rot13', 'Zope is k00l')
         assert (res == 'Mbcr vf x00y'), res
 
+    def checkUnrestrictedEval(self):
+        expr = RestrictionCapableEval("{'a':[m.pop()]}['a'] + [m[0]]")
+        v = [12, 34]
+        expect = v[:]
+        expect.reverse()
+        res = expr.eval({'m':v})
+        assert res == expect, res
+        v = [12, 34]
+        res = expr(m=v)
+        assert res == expect
 
 def test_suite():
     return unittest.makeSuite(RestrictionTests, 'check')