mirror of
https://github.com/django/django.git
synced 2025-10-09 10:10:28 +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:
parent
6bccbc05a4
commit
4769db6b5f
2 changed files with 9 additions and 1 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue