diff options
author | Raymond Hettinger <python@rcn.com> | 2009-08-04 19:13:37 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-08-04 19:13:37 (GMT) |
commit | 99a13eeed18f533100489e7ca42a89de4e8ec07d (patch) | |
tree | 5fbb478db8caca11615841de464bf1c8f5712477 /Lib | |
parent | d935976d7021ddaee728d8e018a4688e85ebd8c7 (diff) | |
download | cpython-99a13eeed18f533100489e7ca42a89de4e8ec07d.zip cpython-99a13eeed18f533100489e7ca42a89de4e8ec07d.tar.gz cpython-99a13eeed18f533100489e7ca42a89de4e8ec07d.tar.bz2 |
Issue 6637: defaultdict.copy() failed with an empty factory.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_defaultdict.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_defaultdict.py b/Lib/test/test_defaultdict.py index 00bd9dc..76fc6a6 100644 --- a/Lib/test/test_defaultdict.py +++ b/Lib/test/test_defaultdict.py @@ -60,6 +60,7 @@ class TestDefaultDict(unittest.TestCase): d1 = defaultdict() self.assertEqual(d1.default_factory, None) self.assertEqual(repr(d1), "defaultdict(None, {})") + self.assertEqual(eval(repr(d1)), d1) d1[11] = 41 self.assertEqual(repr(d1), "defaultdict(None, {11: 41})") d2 = defaultdict(int) @@ -112,6 +113,12 @@ class TestDefaultDict(unittest.TestCase): d4[12] self.assertEqual(d4, {42: [], 12: []}) + # Issue 6637: Copy fails for empty default dict + d = defaultdict() + d['a'] = 42 + e = d.copy() + self.assertEqual(e['a'], 42) + def test_shallow_copy(self): d1 = defaultdict(foobar, {1: 1}) d2 = copy.copy(d1) |