[Zope-Checkins] CVS: Zope3/lib/python/Zope/ContextWrapper/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/ContextWrapper/tests
In directory cvs.zope.org:/tmp/cvs-serv6877/lib/python/Zope/ContextWrapper/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/ContextWrapper/tests/test_proxy.py 1.2 => 1.3 ===
         self.assert_(callable(w))
 
+    def test_proxy_item_protocol(self):
+        w = self.new_proxy({})
+        self.assertRaises(KeyError, lambda: w[1])
+        w[1] = 'a'
+        self.assertEquals(w[1], 'a')
+        del w[1]
+        self.assertRaises(KeyError, lambda: w[1])
+        def del_w_1():
+            del w[1]
+        self.assertRaises(KeyError, del_w_1)
+
     def test_wrapped_iterable(self):
         a = [1, 2, 3]
         b = []