[Zope-Checkins] CVS: Zope3/lib/python/Zope/Security/tests - test_Proxy.py:1.3

Steve Alexander steve@cat-box.net
Fri, 14 Jun 2002 11:56:39 -0400


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

Modified Files:
	test_Proxy.py 
Log Message:
Added tests to demonstrate the former bad handling of PyObject_DelItem()
fixed by Guido's recent checkins.

http://lists.zope.org/pipermail/zope-checkins/2002-June/016362.html
http://lists.zope.org/pipermail/zope-checkins/2002-June/016361.html



=== Zope3/lib/python/Zope/Security/tests/test_Proxy.py 1.2 => 1.3 ===
     def __setitem__(self, key, value):
         self.foo[key] = value
+    def __delitem__(self, key):
+        del self.foo[key]
     def __call__(self, arg):
         return 42
     def __eq__(self, other):
@@ -118,6 +120,16 @@
         self.assertEqual(self.p[0], 42)
 
     def testSetItemFail(self):
+        def doit(): del self.p[0]
+        self.shouldFail(doit)
+
+    def testDelItemOK(self):
+        self.p[0] = 42
+        self.assertEqual(self.p[0], 42)
+        del self.p[0]
+        self.shouldFail(lambda: self.p[0])
+        
+    def testDelItemFail(self):
         def doit(): self.p[10] = 42
         self.shouldFail(doit)