mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #20321 -- Added missing key name in MergeDict KeyError message
Thanks mark.harviston et gmail.com for the report.
This commit is contained in:
@@ -209,6 +209,14 @@ class MergeDictTests(SimpleTestCase):
|
||||
self.assertFalse(empty)
|
||||
self.assertTrue(not_empty)
|
||||
|
||||
def test_key_error(self):
|
||||
"""
|
||||
Test that the message of KeyError contains the missing key name.
|
||||
"""
|
||||
d1 = MergeDict({'key1': 42})
|
||||
with six.assertRaisesRegex(self, KeyError, 'key2'):
|
||||
d1['key2']
|
||||
|
||||
|
||||
class MultiValueDictTests(SimpleTestCase):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user