diff options
| author | Antoine Pitrou <solipsis@pitrou.net> | 2009-05-30 21:04:26 +0000 |
|---|---|---|
| committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-05-30 21:04:26 +0000 |
| commit | c06de477a35669cac037b0bc92a28f9492d76015 (patch) | |
| tree | 904ed4860201b9f345b8f2697c720fc4f5223064 /Lib/test/test_weakref.py | |
| parent | 3b1b8072f5f6b30616ac495c288537dcaac92cab (diff) | |
| download | cpython-git-c06de477a35669cac037b0bc92a28f9492d76015.tar.gz | |
Issue #6149: Fix initialization of WeakValueDictionary objects from non-empty parameters.
Diffstat (limited to 'Lib/test/test_weakref.py')
| -rw-r--r-- | Lib/test/test_weakref.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index 9821e1ba75..049dba2110 100644 --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -942,6 +942,17 @@ class MappingTestCase(TestBase): dict[o] = o.arg return dict, objects + def test_make_weak_valued_dict_from_dict(self): + o = Object(3) + dict = weakref.WeakValueDictionary({364:o}) + self.assertEqual(dict[364], o) + + def test_make_weak_valued_dict_from_weak_valued_dict(self): + o = Object(3) + dict = weakref.WeakValueDictionary({364:o}) + dict2 = weakref.WeakValueDictionary(dict) + self.assertEqual(dict[364], o) + def make_weak_valued_dict(self): dict = weakref.WeakValueDictionary() objects = list(map(Object, range(self.COUNT))) |
