[Zope3-checkins] CVS: Zope3/src/zope/proxy/tests - test_proxy.py:1.11

Jim Fulton jim@zope.com
Wed, 28 May 2003 18:15:27 -0400


Update of /cvs-repository/Zope3/src/zope/proxy/tests
In directory cvs.zope.org:/tmp/cvs-serv6544/src/zope/proxy/tests

Modified Files:
	test_proxy.py 
Log Message:
Added a new introspection method, sameProxiedObjects. This can be used
to do an identity comparison of 2 proxied objects.


=== Zope3/src/zope/proxy/tests/test_proxy.py 1.10 => 1.11 ===
--- Zope3/src/zope/proxy/tests/test_proxy.py:1.10	Wed May 28 13:19:23 2003
+++ Zope3/src/zope/proxy/tests/test_proxy.py	Wed May 28 18:15:27 2003
@@ -470,6 +470,39 @@
     
     """
 
+def test_sameProxiedObjects():
+    """
+    >>> from zope.proxy import ProxyBase, sameProxiedObjects
+    >>> class C:
+    ...     pass
+    >>> c1 = C()
+    >>> c2 = C()
+    >>> int(sameProxiedObjects(c1, c1))
+    1
+    >>> int(sameProxiedObjects(ProxyBase(c1), c1))
+    1
+    >>> int(sameProxiedObjects(ProxyBase(c1), ProxyBase(c1)))
+    1
+    >>> int(sameProxiedObjects(ProxyBase(ProxyBase(c1)), c1))
+    1
+    >>> int(sameProxiedObjects(c1, ProxyBase(c1)))
+    1
+    >>> int(sameProxiedObjects(c1, ProxyBase(ProxyBase(c1))))
+    1
+    >>> int(sameProxiedObjects(c1, c2))
+    0
+    >>> int(sameProxiedObjects(ProxyBase(c1), c2))
+    0
+    >>> int(sameProxiedObjects(ProxyBase(c1), ProxyBase(c2)))
+    0
+    >>> int(sameProxiedObjects(ProxyBase(ProxyBase(c1)), c2))
+    0
+    >>> int(sameProxiedObjects(c1, ProxyBase(c2)))
+    0
+    >>> int(sameProxiedObjects(c1, ProxyBase(ProxyBase(c2))))
+    0
+    """
+
 
 def test_suite():
     suite = unittest.makeSuite(ProxyTestCase)