[Zope3-checkins] CVS: Zope3/src/zope/context/tests - test_wrapperinteraction.py:1.8
Steve Alexander
steve@cat-box.net
Sat, 14 Jun 2003 08:32:39 -0400
Update of /cvs-repository/Zope3/src/zope/context/tests
In directory cvs.zope.org:/tmp/cvs-serv13348/src/zope/context/tests
Modified Files:
test_wrapperinteraction.py
Log Message:
Removed the ContextAware base class. Replaced it with
the ContextAwareDescriptors() class advice.
=== Zope3/src/zope/context/tests/test_wrapperinteraction.py 1.7 => 1.8 ===
--- Zope3/src/zope/context/tests/test_wrapperinteraction.py:1.7 Sat Jun 7 15:05:20 2003
+++ Zope3/src/zope/context/tests/test_wrapperinteraction.py Sat Jun 14 08:32:38 2003
@@ -542,28 +542,32 @@
self.assertEquals(d.checkClear(), [('del', inst)])
-class TestContextAware(unittest.TestCase):
+class Test_contextAwareDescriptors(unittest.TestCase):
- def test_ContextAwareMetaClass(self):
- from zope.context import ContextAwareMetaClass, ContextAware
+ def test_advice(self):
from zope.context import ContextMethod, ContextProperty
+ from zope.context import ContextAwareDescriptors
+ from zope.interface import implements
normal_data_descriptor = LoggingDataDescriptor(23)
normal_descriptor = LoggingDescriptor(23)
context_method = ContextMethod(lambda s: None)
context_descriptor = ContextProperty()
# Check that nothing in particular happens if the class doesn't
- # derive directly from ContextAware.
- class X:
- __metaclass__ = ContextAwareMetaClass
+ # have the advice, but its superclass does.
+ class SuperX:
ndd = normal_data_descriptor
nd = normal_descriptor
+ class X(SuperX):
+ ContextAwareDescriptors()
+
self.assert_(X.ndd is normal_data_descriptor)
self.assert_(X.nd is normal_descriptor)
- class X(ContextAware):
+ class X:
+ ContextAwareDescriptors()
cm = context_method
ndd = normal_data_descriptor
@@ -587,10 +591,6 @@
# descriptor. The rest is covered by the ContextAware(Data)Descriptor
# unit tests.
- def test_ContextAware(self):
- from zope.context import ContextAware, ContextAwareMetaClass
- self.assert_(type(ContextAware) is ContextAwareMetaClass)
-
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(TestNewStyleClass),
@@ -599,7 +599,7 @@
unittest.makeSuite(TestWrapperOnObjectsWithDifferentSlots),
unittest.makeSuite(TestContextAwareDataDescriptor),
unittest.makeSuite(TestContextAwareDescriptor),
- unittest.makeSuite(TestContextAware),
+ unittest.makeSuite(Test_contextAwareDescriptors),
))