def test_value_omitted_from_data_subwidgets_name(self):
     widget = MultiWidget(widgets={"x": TextInput(), "": TextInput()})
     tests = [
         ({}, True),
         ({
             "field": "x"
         }, False),
         ({
             "field_x": "y"
         }, False),
         ({
             "field": "x",
             "field_x": "y"
         }, False),
     ]
     for data, expected in tests:
         with self.subTest(data):
             self.assertIs(
                 widget.value_omitted_from_data(data, {}, "field"),
                 expected,
             )
Beispiel #2
0
 def test_value_omitted_from_data_subwidgets_name(self):
     widget = MultiWidget(widgets={'x': TextInput(), '': TextInput()})
     tests = [
         ({}, True),
         ({
             'field': 'x'
         }, False),
         ({
             'field_x': 'y'
         }, False),
         ({
             'field': 'x',
             'field_x': 'y'
         }, False),
     ]
     for data, expected in tests:
         with self.subTest(data):
             self.assertIs(
                 widget.value_omitted_from_data(data, {}, 'field'),
                 expected,
             )