def test_format_time(self): value = datetime.datetime(2009, 11, 10, 16, 36, 05) self.assertEqual(i18n.format_time(value, format='short'), u'4:36 PM') self.assertEqual(i18n.format_time(value, format='medium'), u'4:36:05 PM') self.assertEqual(i18n.format_time(value, format='long'), u'4:36:05 PM +0000') self.assertEqual(i18n.format_time(value, format='full'), u'4:36:05 PM World (GMT) Time')
def test_format_time(self): value = datetime.datetime(2009, 11, 10, 16, 36, 05) self.assertEqual(i18n.format_time(value, format='short'), u'4:36 PM') self.assertEqual(i18n.format_time(value, format='medium'), u'4:36:05 PM') self.assertEqual(i18n.format_time(value, format='long'), u'4:36:05 PM +0000') #self.assertEqual(i18n.format_time(value, format='full'), u'4:36:05 PM World (GMT) Time') self.assertEqual(i18n.format_time(value, format='full'), u'4:36:05 PM GMT+00:00')
def test_format_time_pt_BR(self): i18n.set_locale('pt_BR') value = datetime.datetime(2009, 11, 10, 16, 36, 05) self.assertEqual(i18n.format_time(value, format='short'), u'16:36') self.assertEqual(i18n.format_time(value, format='medium'), u'16:36:05') self.assertEqual(i18n.format_time(value, format='long'), u'16:36:05 +0000') self.assertEqual(i18n.format_time(value, format='full'), u'16h36min05s Horário Mundo (GMT)') i18n.set_timezone('America/Chicago') self.assertEqual(i18n.format_time(value, format='short'), u'10:36')
def test_format_time_pt_BR(self): i18n.set_locale('pt_BR') value = datetime.datetime(2009, 11, 10, 16, 36, 05) self.assertEqual(i18n.format_time(value, format='short'), u'16:36') self.assertEqual(i18n.format_time(value, format='medium'), u'16:36:05') #self.assertEqual(i18n.format_time(value, format='long'), u'16:36:05 +0000') self.assertEqual(i18n.format_time(value, format='long'), u'16h36min05s +0000') #self.assertEqual(i18n.format_time(value, format='full'), u'16h36min05s Horário Mundo (GMT)') self.assertEqual(i18n.format_time(value, format='full'), u'16h36min05s GMT+00:00') i18n.set_timezone('America/Chicago') self.assertEqual(i18n.format_time(value, format='short'), u'10:36')
def test_format_iso(self): value = datetime.datetime(2009, 11, 10, 16, 36, 05) self.assertEqual(i18n.format_date(value, format='iso'), u'2009-11-10') self.assertEqual(i18n.format_time(value, format='iso'), u'16:36:05') self.assertEqual(i18n.format_datetime(value, format='iso'), u'2009-11-10T16:36:05+0000')
def test_format_time_no_format(self): value = datetime.datetime(2009, 11, 10, 16, 36, 05) self.assertEqual(i18n.format_time(value), u'4:36:05 PM')