diff options
author | Claude Paroz <claude@2xlibre.net> | 2013-04-26 08:57:39 +0200 |
---|---|---|
committer | Claude Paroz <claude@2xlibre.net> | 2013-04-26 08:59:34 +0200 |
commit | 4769db6b5fddaed93a8d8d03d0c36f7262e9ac8b (patch) | |
tree | 3fa285cfcd24516732e2c1a790948ee547629f8d /tests/utils_tests/test_datastructures.py | |
parent | 6bccbc05a443b97e8651a36df10de6ac5283aee4 (diff) | |
download | django-4769db6b5fddaed93a8d8d03d0c36f7262e9ac8b.tar.gz |
Fixed #20321 -- Added missing key name in MergeDict KeyError message
Thanks mark.harviston et gmail.com for the report.
Diffstat (limited to 'tests/utils_tests/test_datastructures.py')
-rw-r--r-- | tests/utils_tests/test_datastructures.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/utils_tests/test_datastructures.py b/tests/utils_tests/test_datastructures.py index 91111cc2ed..5829e7c2d7 100644 --- a/tests/utils_tests/test_datastructures.py +++ b/tests/utils_tests/test_datastructures.py @@ -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): |