MCPcopy
hub / github.com/django/django / test_setdefault

Method test_setdefault

tests/utils_tests/test_datastructures.py:188–194  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

186 self.assertEqual(list(x.lists()), [("a", [3])])
187
188 def test_setdefault(self):
189 x = MultiValueDict({"a": [1, 2]})
190 a = x.setdefault("a", 3)
191 b = x.setdefault("b", 3)
192 self.assertEqual(a, 2)
193 self.assertEqual(b, 3)
194 self.assertEqual(list(x.lists()), [("a", [1, 2]), ("b", [3])])
195
196 def test_update_too_many_args(self):
197 x = MultiValueDict({"a": []})

Callers

nothing calls this directly

Calls 3

setdefaultMethod · 0.95
listsMethod · 0.95
MultiValueDictClass · 0.90

Tested by

no test coverage detected