mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
A test case for the defaultdict KeyError bug.
This commit is contained in:
parent
b51a57eb32
commit
72363031b9
1 changed files with 9 additions and 0 deletions
|
|
@ -132,6 +132,15 @@ def test_deep_copy(self):
|
|||
self.assertEqual(d2.default_factory, list)
|
||||
self.assertEqual(d2, d1)
|
||||
|
||||
def test_keyerror_without_factory(self):
|
||||
d1 = defaultdict()
|
||||
try:
|
||||
d1[(1,)]
|
||||
except KeyError, err:
|
||||
self.assertEqual(err.message, (1,))
|
||||
else:
|
||||
self.fail("expected KeyError")
|
||||
|
||||
|
||||
def test_main():
|
||||
test_support.run_unittest(TestDefaultDict)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue