summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_weakref.py
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2003-12-11 12:34:05 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2003-12-11 12:34:05 (GMT)
commitb167b04a2ed74dc746c5a584bc9ac1ebfe604442 (patch)
tree4b74106dc50aa8947bcb6853eaa8be8a8fcfda78 /Lib/test/test_weakref.py
parent35415da67c11e2a3193644c5186df340cde93042 (diff)
downloadcpython-b167b04a2ed74dc746c5a584bc9ac1ebfe604442.zip
cpython-b167b04a2ed74dc746c5a584bc9ac1ebfe604442.tar.gz
cpython-b167b04a2ed74dc746c5a584bc9ac1ebfe604442.tar.bz2
Add tests to test_weakref.py to bring code coverage in _weakref.c up to 100%.
Port test_md5.py to PyUnit. (Written by Neal Norwitz; from SF patch 736962) (Backport candidate)
Diffstat (limited to 'Lib/test/test_weakref.py')
-rw-r--r--Lib/test/test_weakref.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index 34831f1..d42922a 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -249,6 +249,10 @@ class ReferencesTestCase(TestBase):
self.assert_(weakref.getweakrefcount(o) == 4,
"got wrong number of weak reference objects")
+ # assumes ints do not support weakrefs
+ self.assert_(weakref.getweakrefcount(1) == 0,
+ "got wrong number of weak reference objects for int")
+
def test_getweakrefs(self):
o = C()
ref1 = weakref.ref(o, self.callback)
@@ -264,6 +268,10 @@ class ReferencesTestCase(TestBase):
self.assert_(weakref.getweakrefs(o) == [ref1],
"list of refs does not match")
+ # assumes ints do not support weakrefs
+ self.assert_(weakref.getweakrefs(1) == [],
+ "list of refs does not match for int")
+
def test_newstyle_number_ops(self):
class F(float):
pass