MCPcopy
hub / github.com/django/django / test_get_context

Method test_get_context

tests/postgres_tests/test_array.py:1459–1494  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1457
1458class TestSplitFormWidget(PostgreSQLWidgetTestCase):
1459 def test_get_context(self):
1460 self.assertEqual(
1461 SplitArrayWidget(forms.TextInput(), size=2).get_context(
1462 "name", ["val1", "val2"]
1463 ),
1464 {
1465 "widget": {
1466 "name": "name",
1467 "is_hidden": False,
1468 "required": False,
1469 "value": "['val1', 'val2']",
1470 "attrs": {},
1471 "template_name": "postgres/widgets/split_array.html",
1472 "subwidgets": [
1473 {
1474 "name": "name_0",
1475 "is_hidden": False,
1476 "required": False,
1477 "value": "val1",
1478 "attrs": {},
1479 "template_name": "django/forms/widgets/text.html",
1480 "type": "text",
1481 },
1482 {
1483 "name": "name_1",
1484 "is_hidden": False,
1485 "required": False,
1486 "value": "val2",
1487 "attrs": {},
1488 "template_name": "django/forms/widgets/text.html",
1489 "type": "text",
1490 },
1491 ],
1492 }
1493 },
1494 )
1495
1496 def test_checkbox_get_context_attrs(self):
1497 context = SplitArrayWidget(

Callers

nothing calls this directly

Calls 2

SplitArrayWidgetClass · 0.90
get_contextMethod · 0.45

Tested by

no test coverage detected