django/tests/forms_tests/widget_tests/test_widget.py

16 lines
545 B
Python
Raw Normal View History

from django.forms import Widget
from django.forms.widgets import Input
from .base import WidgetTest
class WidgetTests(WidgetTest):
def test_value_omitted_from_data(self):
widget = Widget()
self.assertIs(widget.value_omitted_from_data({}, {}, 'field'), True)
self.assertIs(widget.value_omitted_from_data({'field': 'value'}, {}, 'field'), False)
def test_no_trailing_newline_in_attrs(self):
self.check_html(Input(), 'name', 'value', strict=True, html='<input type="None" name="name" value="value" />')