summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-04-11 03:59:42 (GMT)
committerFred Drake <fdrake@acm.org>2002-04-11 03:59:42 (GMT)
commit43735da1bf75422e473067d55da3cf0319c9d69c (patch)
treec7aacf9bf779fccf18a02195c243f0e1bb6f60cd /Lib/test
parent17850f79a84e806f38847e6669b41e934a4172dd (diff)
downloadcpython-43735da1bf75422e473067d55da3cf0319c9d69c.zip
cpython-43735da1bf75422e473067d55da3cf0319c9d69c.tar.gz
cpython-43735da1bf75422e473067d55da3cf0319c9d69c.tar.bz2
Improve coverage of Objects/weakrefobject.c.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_weakref.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index 2ca6a7a..9f16482 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -46,6 +46,15 @@ class ReferencesTestCase(TestBase):
self.check_basic_ref(create_bound_method)
self.check_basic_ref(create_unbound_method)
+ # Just make sure the tp_repr handler doesn't raise an exception.
+ # Live reference:
+ o = C()
+ wr = weakref.ref(o)
+ `wr`
+ # Dead reference:
+ del o
+ `wr`
+
def test_basic_callback(self):
self.check_basic_callback(C)
self.check_basic_callback(create_function)
@@ -166,6 +175,13 @@ class ReferencesTestCase(TestBase):
L2 = UserList.UserList(L)
p2 = weakref.proxy(L2)
self.assertEqual(p, p2)
+ ## self.assertEqual(`L2`, `p2`)
+ L3 = UserList.UserList(range(10))
+ p3 = weakref.proxy(L3)
+ self.assertEqual(L3[:], p3[:])
+ self.assertEqual(L3[5:], p3[5:])
+ self.assertEqual(L3[:5], p3[:5])
+ self.assertEqual(L3[2:5], p3[2:5])
def test_callable_proxy(self):
o = Callable()