]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use the WeakKeyDictionary and WeakValueDictionary classes directly
authorFred Drake <fdrake@acm.org>
Tue, 10 Apr 2001 19:09:35 +0000 (19:09 +0000)
committerFred Drake <fdrake@acm.org>
Tue, 10 Apr 2001 19:09:35 +0000 (19:09 +0000)
instead of using the mapping() function.

Lib/test/test_weakref.py

index 1e193f1920be3062dc61d454221a5a6d23680680..d818b3365bb2bd5983d5809e7e466ab01d3abc1e 100644 (file)
@@ -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 @@ class MappingTestCase(TestBase):
                      "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