[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/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 11:55:56 EDT 2004


Log message for revision 26999:
  make the zope.security tests pass with Python 2.4


Changed:
  U   Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_proxy.py


-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_proxy.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_proxy.py	2004-08-11 15:47:05 UTC (rev 26998)
+++ Zope3/branches/ZopeX3-3.0/src/zope/security/tests/test_proxy.py	2004-08-11 15:55:55 UTC (rev 26999)
@@ -19,6 +19,8 @@
 
     ok = 1
 
+    unproxied_types = str,
+
     def check_getattr(self, object, name):
         if name not in ("foo", "next", "__class__", "__name__", "__module__"):
             raise RuntimeError
@@ -32,7 +34,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)
 
@@ -242,11 +244,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