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)
This commit is contained in:
Walter Dörwald 2003-12-11 12:34:05 +00:00
parent 35415da67c
commit b167b04a2e
3 changed files with 52 additions and 25 deletions

View file

@ -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