mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Use the WeakKeyDictionary and WeakValueDictionary classes directly
instead of using the mapping() function.
This commit is contained in:
parent
f6cdead8e9
commit
bf43691ccb
1 changed files with 2 additions and 2 deletions
|
@ -210,7 +210,7 @@ class MappingTestCase(TestBase):
|
||||||
COUNT = 10
|
COUNT = 10
|
||||||
|
|
||||||
def test_weak_values(self):
|
def test_weak_values(self):
|
||||||
dict = weakref.mapping()
|
dict = weakref.WeakValueDictionary()
|
||||||
objects = map(Object, range(self.COUNT))
|
objects = map(Object, range(self.COUNT))
|
||||||
for o in objects:
|
for o in objects:
|
||||||
dict[o.arg] = o
|
dict[o.arg] = o
|
||||||
|
@ -236,7 +236,7 @@ class MappingTestCase(TestBase):
|
||||||
"deleting the values did not clear the dictionary")
|
"deleting the values did not clear the dictionary")
|
||||||
|
|
||||||
def test_weak_keys(self):
|
def test_weak_keys(self):
|
||||||
dict = weakref.mapping(weakkeys=1)
|
dict = weakref.WeakKeyDictionary()
|
||||||
objects = map(Object, range(self.COUNT))
|
objects = map(Object, range(self.COUNT))
|
||||||
for o in objects:
|
for o in objects:
|
||||||
dict[o] = o.arg
|
dict[o] = o.arg
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue