from datetime import datetime
from django.forms import SplitHiddenDateTimeWidget
from django.test import override_settings
from django.utils import translation
from .base import WidgetTest
class SplitHiddenDateTimeWidgetTest(WidgetTest):
widget = SplitHiddenDateTimeWidget()
def test_render_empty(self):
self.check_html(self.widget, 'date', '', html=(
''
))
def test_render_value(self):
d = datetime(2007, 9, 17, 12, 51, 34, 482548)
self.check_html(self.widget, 'date', d, html=(
''
''
))
self.check_html(self.widget, 'date', datetime(2007, 9, 17, 12, 51, 34), html=(
''
''
))
self.check_html(self.widget, 'date', datetime(2007, 9, 17, 12, 51), html=(
''
''
))
@override_settings(USE_L10N=True)
@translation.override('de-at')
def test_l10n(self):
d = datetime(2007, 9, 17, 12, 51)
self.check_html(self.widget, 'date', d, html=(
"""
"""
))