[Zope3-checkins] SVN: Zope3/trunk/src/zope/security/tests/test_proxy.py make the zope.security tests pass with Python 2.4

Fred L. Drake, Jr. fdrake at gmail.com
Wed Aug 11 12:11:54 EDT 2004


Log message for revision 27001:
  make the zope.security tests pass with Python 2.4
  
  (merged from ZopeX3-3.0 branch revision 26999)
  


Changed:
  U   Zope3/trunk/src/zope/security/tests/test_proxy.py


-=-
Modified: Zope3/trunk/src/zope/security/tests/test_proxy.py
===================================================================
--- Zope3/trunk/src/zope/security/tests/test_proxy.py	2004-08-11 16:08:41 UTC (rev 27000)
+++ Zope3/trunk/src/zope/security/tests/test_proxy.py	2004-08-11 16:11:54 UTC (rev 27001)
@@ -24,6 +24,8 @@
 
     ok = 1
 
+    unproxied_types = str,
+
     def check_getattr(self, object, name):
         if name not in ("foo", "next", "__class__", "__name__", "__module__"):
             raise RuntimeError
@@ -37,7 +39,7 @@
             raise RuntimeError
 
     def proxy(self, value):
-        if type(value) is str:
+        if type(value) in self.unproxied_types:
             return value
         return ProxyFactory(value, self)
 
@@ -247,11 +249,16 @@
         ]
 
     def test_unops(self):
-        P = self.c.proxy
+        # We want the starting value of the expressions to be a proxy,
+        # but we don't want to create new proxies as a result of
+        # evaluation, so we have to extend the list of types that
+        # aren't proxied.
+        self.c.unproxied_types = str, int, long, float
         for expr in self.unops:
             x = 1
             y = eval(expr)
-            x = P(1)
+            # Make sure 'x' is a proxy always:
+            x = ProxyFactory(1, self.c)
             z = eval(expr)
             self.assertEqual(getProxiedObject(z), y,
                              "x=%r; expr=%r" % (x, expr))



More information about the Zope3-Checkins mailing list