summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_deque.py7
-rw-r--r--Lib/test/test_set.py8
2 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py
index bad885761e..13800ea215 100644
--- a/Lib/test/test_deque.py
+++ b/Lib/test/test_deque.py
@@ -1,6 +1,7 @@
from collections import deque
import unittest
from test import test_support
+from weakref import proxy
import copy
import cPickle as pickle
from cStringIO import StringIO
@@ -435,6 +436,12 @@ class TestSubclass(unittest.TestCase):
self.assertEqual(type(d), type(e))
self.assertEqual(list(d), list(e))
+ def test_weakref(self):
+ d = deque('gallahad')
+ p = proxy(d)
+ self.assertEqual(str(p), str(d))
+ d = None
+ self.assertRaises(ReferenceError, str, p)
#==============================================================================
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py
index 3a85c767a8..514b75c0d6 100644
--- a/Lib/test/test_set.py
+++ b/Lib/test/test_set.py
@@ -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 @@ class TestSet(TestJointOps):
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