Exemplo n.º 1
0
    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')
Exemplo n.º 2
0
    def test_format_time(self):
        value = datetime.datetime(2009, 11, 10, 16, 36, 5)

        self.assertEqual(i18n.format_time(value, format="short"), "4:36 PM")
        self.assertEqual(i18n.format_time(value, format="medium"), "4:36:05 PM")
        self.assertEqual(i18n.format_time(value, format="long"), "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"), "4:36:05 PM GMT+00:00")
Exemplo n.º 3
0
    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')
Exemplo n.º 4
0
    def test_format_time_pt_BR(self):
        i18n.get_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.get_i18n().set_timezone('America/Chicago')
        self.assertEqual(i18n.format_time(value, format='short'), u'10:36')
Exemplo n.º 5
0
    def test_format_time_pt_BR(self):
        i18n.get_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.get_i18n().set_timezone('America/Chicago')
        self.assertEqual(i18n.format_time(value, format='short'), u'10:36')
Exemplo n.º 6
0
    def test_format_time_pt_BR(self):
        i18n.get_i18n().set_locale("pt_BR")
        value = datetime.datetime(2009, 11, 10, 16, 36, 5)

        self.assertEqual(i18n.format_time(value, format="short"), "16:36")
        self.assertEqual(i18n.format_time(value, format="medium"), "16:36:05")
        # self.assertEqual(i18n.format_time(value, format='long'),
        #  u'16:36:05 +0000')
        self.assertEqual(i18n.format_time(value, format="long"), "16:36:05 +0000")
        # self.assertEqual(i18n.format_time(value, format='full'),
        #  u'16h36min05s Horário Mundo (GMT)')
        self.assertEqual(i18n.format_time(value, format="full"), "16:36:05 GMT+00:00")

        i18n.get_i18n().set_timezone("America/Chicago")
        self.assertEqual(i18n.format_time(value, format="short"), "10:36")
Exemplo n.º 7
0
def get_time_list():
    time_list = []
    for t in range(7, 23):
        time_obj = string_to_time(str(t))
        time_list.append((t, format_time(time_obj, format="short", rebase=True)))
    
    return time_list
Exemplo n.º 8
0
    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')
Exemplo n.º 9
0
    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')
Exemplo n.º 10
0
    def test_format_iso(self):
        value = datetime.datetime(2009, 11, 10, 16, 36, 5)

        self.assertEqual(i18n.format_date(value, format="iso"), "2009-11-10")
        self.assertEqual(i18n.format_time(value, format="iso"), "16:36:05")
        self.assertEqual(
            i18n.format_datetime(value, format="iso"), "2009-11-10T16:36:05+0000"
        )
Exemplo n.º 11
0
 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')
Exemplo n.º 12
0
 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')