[Zope3-checkins] CVS: Zope3/lib/python/Zope/ContextWrapper/tests - testSimpleMethodWrapper.py:1.7

Steve Alexander steve@cat-box.net
Tue, 12 Nov 2002 10:55:59 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/ContextWrapper/tests
In directory cvs.zope.org:/tmp/cvs-serv15617/lib/python/Zope/ContextWrapper/tests

Modified Files:
	testSimpleMethodWrapper.py 
Log Message:
updated the tests.

made setting a ContextProperty when you have that name in an instance
dict work.


=== Zope3/lib/python/Zope/ContextWrapper/tests/testSimpleMethodWrapper.py 1.6 => 1.7 ===
--- Zope3/lib/python/Zope/ContextWrapper/tests/testSimpleMethodWrapper.py:1.6	Tue Nov 12 05:57:34 2002
+++ Zope3/lib/python/Zope/ContextWrapper/tests/testSimpleMethodWrapper.py	Tue Nov 12 10:55:58 2002
@@ -177,20 +177,15 @@
         self.assertEqual(self.wrapped.thisIsAContextGetProperty, True)
         self.assert_(self.obj.result is self.wrapped)
 
-    def testGetContextProperty_w_name_in_dict(self):
-        self.obj.thisIsAContextProperty = False
-        self.assertEqual(self.wrapped.thisIsAContextProperty, True)
-        self.assert_(self.obj.result is self.wrapped)
-
     def testNotFound(self):
         self.assertRaises(AttributeError,
                           getattr, self.wrapped, 'noSuchAttribute')
 
 
-class TestNewStyleClass(TestClassicClass):
+class TestNewStyleClassWithSlots(TestClassicClass):
 
     def createObject(self):
-        return NewStyleClass()
+        return NewStyleClassWithSlots()
 
     # Setting properties doesn't work with classic classes,
     # so this class has extra tests for setting properties in
@@ -221,11 +216,31 @@
         self.assert_(result_obj is self.wrapped)
         self.assert_(result_value is value)
 
-class TestNewStyleClassWithSlots(TestNewStyleClass):
+class TestNewStyleClass(TestNewStyleClassWithSlots):
 
     def createObject(self):
-        return NewStyleClassWithSlots()
+        return NewStyleClass()
 
+    def testGetContextProperty_w_name_in_dict(self):
+        self.obj.__dict__['thisIsAContextProperty'] = False
+        self.assertEqual(self.obj.thisIsAContextProperty, True)
+        self.assert_(self.obj.result is self.obj)
+        self.assertEqual(self.wrapped.thisIsAContextProperty, True)
+        self.assert_(self.obj.result is self.wrapped)
+
+    def testSetContextProperty_w_name_in_dict(self):
+        self.obj.__dict__['thisIsAContextProperty'] = False
+        value = 23
+        self.obj.thisIsAContextProperty = value
+        result_obj, result_value = self.obj.result
+        self.assert_(result_obj is self.obj)
+        self.assert_(result_value is value)
+
+        self.wrapped.thisIsAContextProperty = value
+        result_obj, result_value = self.wrapped.result
+        self.assert_(result_obj is self.wrapped)
+        self.assert_(result_value is value)
+        
 
 def test_suite():
     return unittest.TestSuite((