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

Jim Fulton jim at zope.com
Mon Sep 8 15:21:57 EDT 2003


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

Modified Files:
      Tag: parentgeddon-branch
	test_proxy.py 
Log Message:
Checking in work in progress on parentgeddon-branch so Fred can help
me to get the tests passing.  Specific log entries will be provided
when we merge this into the head.


=== Zope3/src/zope/proxy/tests/test_proxy.py 1.14 => 1.14.16.1 ===
--- Zope3/src/zope/proxy/tests/test_proxy.py:1.14	Tue Jul  1 19:26:38 2003
+++ Zope3/src/zope/proxy/tests/test_proxy.py	Mon Sep  8 14:21:56 2003
@@ -513,6 +513,43 @@
     0
     """
 
+def test_subclassing_proxies():
+    """You can subclass ProxyBase
+
+    If you subclass a proxy, instances of the subclass have access to
+    data defined in the class, including descriptors.
+
+    Your subclass instances don't get instance dictionaries, but they
+    can have slots.
+
+    >>> class MyProxy(ProxyBase):
+    ...    __slots__ = 'x', 'y'
+    ...
+    ...    def f(self):
+    ...        return self.x
+
+    >>> l = [1, 2, 3]
+    >>> p = MyProxy(l)
+
+    I can use attributes defined by the class, including slots:
+    
+    >>> p.x = 'x'
+    >>> p.x
+    'x'
+    >>> p.f()
+    'x'
+
+    I can also use attributes of the proxied object:
+    
+    >>> p
+    [1, 2, 3]
+    >>> p.pop()
+    3
+    >>> p
+    [1, 2]
+    
+    """
+
 
 def test_suite():
     suite = unittest.makeSuite(ProxyTestCase)




More information about the Zope3-Checkins mailing list