MCPcopy
hub / github.com/django/django / test_callable

Method test_callable

tests/utils_tests/test_choices.py:165–180  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

163 self.assertEqual(normalize_choices(Medal), expected)
164
165 def test_callable(self):
166 def get_choices():
167 return {
168 "C": _("Club"),
169 "D": _("Diamond"),
170 "H": _("Heart"),
171 "S": _("Spade"),
172 }
173
174 get_choices_spy = mock.Mock(wraps=get_choices)
175 output = normalize_choices(get_choices_spy)
176
177 get_choices_spy.assert_not_called()
178 self.assertIsInstance(output, CallableChoiceIterator)
179 self.assertEqual(output, self.expected)
180 get_choices_spy.assert_called_once()
181
182 def test_mapping(self):
183 choices = {

Callers

nothing calls this directly

Calls 1

normalize_choicesFunction · 0.90

Tested by

no test coverage detected