summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-06-10 20:00:52 (GMT)
committerGuido van Rossum <guido@python.org>2002-06-10 20:00:52 (GMT)
commit009afb7c90882ee83e196b62b1555067e14fd950 (patch)
treecfba62798e8602a7c721f81572ad5df2f1ad9a12 /Lib/test
parent804cdca7ea38e197e8ac6a9a748a25dc19543079 (diff)
downloadcpython-009afb7c90882ee83e196b62b1555067e14fd950.zip
cpython-009afb7c90882ee83e196b62b1555067e14fd950.tar.gz
cpython-009afb7c90882ee83e196b62b1555067e14fd950.tar.bz2
SF patch 564549 (Erik Andersén).
The WeakKeyDictionary constructor didn't work when a dict arg was given. Fixed by moving a line. Also adding a unit test. Bugfix candidate.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_weakref.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index 9f16482..0764358 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -391,6 +391,17 @@ class MappingTestCase(TestBase):
values.remove(v)
self.assert_(len(values) == 0, "itervalues() did not touch all values")
+ def test_make_weak_keyed_dict_from_dict(self):
+ o = Object(3)
+ dict = weakref.WeakKeyDictionary({o:364})
+ self.assert_(dict[o] == 364)
+
+ def test_make_weak_keyed_dict_from_weak_keyed_dict(self):
+ o = Object(3)
+ dict = weakref.WeakKeyDictionary({o:364})
+ dict2 = weakref.WeakKeyDictionary(dict)
+ self.assert_(dict[o] == 364)
+
def make_weak_keyed_dict(self):
dict = weakref.WeakKeyDictionary()
objects = map(Object, range(self.COUNT))