[Python-checkins] python/dist/src/Lib/test test_weakref.py,1.26,1.27

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Sun, 29 Jun 2003 21:18:50 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv19251/Lib/test

Modified Files:
	test_weakref.py 
Log Message:
Fix SF 762891:  "del p[key]" on proxy object raises SystemError()



Index: test_weakref.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** test_weakref.py	25 May 2003 17:44:31 -0000	1.26
--- test_weakref.py	30 Jun 2003 04:18:48 -0000	1.27
***************
*** 227,230 ****
--- 227,241 ----
                       "object does not reflect attribute removal via proxy")
  
+     def test_proxy_deletion(self):
+         # Test clearing of SF bug #762891
+         class Foo:
+             result = None
+             def __delitem__(self, accessor):
+                 self.result = accessor
+         g = Foo()
+         f = weakref.proxy(g)
+         del f[0]
+         self.assertEqual(f.result, 0)
+ 
      def test_getweakrefcount(self):
          o = C()