def test_localization(self): w = AdminSplitDateTime() with self.settings(USE_L10N=True): with translation.override('de-at'): w.is_localized = True self.assertEqual( conditional_escape(w.render('test', datetime(2007, 12, 1, 9, 30))), '<p class="datetime">Datum: <input value="01.12.2007" type="text" class="vDateField" name="test_0" size="10" /><br />Zeit: <input value="09:30:00" type="text" class="vTimeField" name="test_1" size="8" /></p>', )
def test_localization(self): w = AdminSplitDateTime() with self.settings(USE_L10N=True): with translation.override('de-at'): w.is_localized = True self.assertEqual( conditional_escape( w.render('test', datetime(2007, 12, 1, 9, 30))), '<p class="datetime">Datum: <input value="01.12.2007" type="text" class="vDateField" name="test_0" size="10" /><br />Zeit: <input value="09:30:00" type="text" class="vTimeField" name="test_1" size="8" /></p>', )
def test_localization(self): w = AdminSplitDateTime() activate('de-at') old_USE_L10N = settings.USE_L10N try: settings.USE_L10N = True w.is_localized = True self.assertEqual( conditional_escape(w.render('test', datetime(2007, 12, 1, 9, 30))), '<p class="datetime">Datum: <input value="01.12.2007" type="text" class="vDateField" name="test_0" size="10" /><br />Zeit: <input value="09:30:00" type="text" class="vTimeField" name="test_1" size="8" /></p>', ) finally: deactivate() settings.USE_L10N = old_USE_L10N
def test_render(self): w = AdminSplitDateTime() self.assertEqual( conditional_escape(w.render('test', datetime(2007, 12, 1, 9, 30))), '<p class="datetime">Date: <input value="2007-12-01" type="text" class="vDateField" name="test_0" size="10" /><br />Time: <input value="09:30:00" type="text" class="vTimeField" name="test_1" size="8" /></p>', )