1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #20276 -- Implemented __bool__ for MergeDict

MergeDict evaluates now to False if all contained dicts are empty.
Thanks til for the report and the initial patch.
This commit is contained in:
Anton Baklanov
2013-04-17 18:20:31 +03:00
committed by Claude Paroz
parent bfe25de429
commit 59d127e45f
2 changed files with 13 additions and 0 deletions

View File

@@ -203,6 +203,13 @@ class MergeDictTests(SimpleTestCase):
('key2', ['value2', 'value3']),
('key4', ['value5', 'value6'])])
def test_bool_casting(self):
empty = MergeDict({}, {}, {})
not_empty = MergeDict({}, {}, {"key": "value"})
self.assertFalse(empty)
self.assertTrue(not_empty)
class MultiValueDictTests(SimpleTestCase):
def test_multivaluedict(self):