mirror of https://github.com/python/cpython.git
Use the WeakKeyDictionary and WeakValueDictionary classes directly
instead of using the mapping() function.
This commit is contained in:
parent
f6cdead8e9
commit
bf43691ccb
|
@ -210,7 +210,7 @@ class MappingTestCase(TestBase):
|
|||
COUNT = 10
|
||||
|
||||
def test_weak_values(self):
|
||||
dict = weakref.mapping()
|
||||
dict = weakref.WeakValueDictionary()
|
||||
objects = map(Object, range(self.COUNT))
|
||||
for o in objects:
|
||||
dict[o.arg] = o
|
||||
|
@ -236,7 +236,7 @@ def test_weak_values(self):
|
|||
"deleting the values did not clear the dictionary")
|
||||
|
||||
def test_weak_keys(self):
|
||||
dict = weakref.mapping(weakkeys=1)
|
||||
dict = weakref.WeakKeyDictionary()
|
||||
objects = map(Object, range(self.COUNT))
|
||||
for o in objects:
|
||||
dict[o] = o.arg
|
||||
|
|
Loading…
Reference in New Issue