diff Lib/test/test_set.py @ 32158:679e5c8effae legacy-trunk

Make sets and deques weak referencable.
author Raymond Hettinger <python@rcn.com>
date Sun, 30 May 2004 07:26:47 +0000
parents 71a294bd7950
children d909a0ddd193
line wrap: on
line diff
--- a/Lib/test/test_set.py	Fri May 28 20:59:21 2004 +0000
+++ b/Lib/test/test_set.py	Sun May 30 07:26:47 2004 +0000
@@ -1,5 +1,6 @@
 import unittest
 from test import test_support
+from weakref import proxy
 import operator
 import copy
 import pickle
@@ -346,6 +347,13 @@
             else:
                 self.assert_(c not in self.s)
 
+    def test_weakref(self):
+        s = self.thetype('gallahad')
+        p = proxy(s)
+        self.assertEqual(str(p), str(s))
+        s = None
+        self.assertRaises(ReferenceError, str, p)
+
 class SetSubclass(set):
     pass