def test_get_era_names(self): i18n.set_locale(i18n.Locale('en', 'US')) self.assertEqual(i18n.get_era_names(), {0: u'Before Christ', 1: u'Anno Domini'}) self.assertEqual(i18n.get_era_names(width='wide'), {0: u'Before Christ', 1: u'Anno Domini'}) self.assertEqual(i18n.get_era_names(width='abbreviated'), {0: u'BC', 1: u'AD'}) self.assertEqual(i18n.get_era_names(width='narrow'), {0: u'B', 1: u'A'})
def setup_module(module): local.request = local.Process() locale = i18n.Locale('fr', 'FR', dirname=os.path.join(os.path.dirname(__file__), 'locale')) i18n.set_locale(locale)
def test_format_time_time_with_format(self): i18n.set_locale(i18n.Locale('en', 'US', timezone='Pacific/Pitcairn')) t = datetime.time(15, 30) self.assertEqual(i18n.format_time(t, format="hh 'o''clock' a, zzzz"), "03 o'clock PM, Pitcairn Time") t = datetime.time(15, 30, tzinfo=pytz.timezone('Africa/Niamey')) self.assertEqual(i18n.format_time(t, format="hh 'o''clock' a, zzzz"), "03 o'clock PM, Pitcairn Time")
def test_get_timezone_location(): set_locale(Locale('de', 'DE')) tz = pytz.timezone('America/St_Johns') assert i18n.get_timezone_location(tz) == u'Kanada (St. John’s)' set_locale(Locale('de', 'DE')) tz = pytz.timezone('America/Mexico_City') assert i18n.get_timezone_location(tz) == 'Mexiko (Mexiko-Stadt)'
def test_format_time_time_with_format(): i18n.set_locale(i18n.Locale('en', 'US', timezone='America/Los_Angeles')) t = datetime.time(15, 30) assert i18n.format_time(t, format="hh 'o''clock' a, zzzz") == "03 o'clock PM, Pacific Standard Time" t = datetime.time(15, 30, tzinfo=pytz.timezone('Europe/Paris')) assert i18n.format_time(t, format="hh 'o''clock' a, zzzz") == "03 o'clock PM, Pacific Standard Time"
def test_format_time_datetime_with_format(): i18n.set_locale(i18n.Locale('en', 'US', timezone='America/Los_Angeles')) d = datetime.datetime(2007, 4, 1, 15, 30) assert i18n.format_time(d, format="hh 'o''clock' a, zzzz") == "03 o'clock PM, Pacific Daylight Time" d = datetime.datetime(2007, 4, 1, 15, 30, tzinfo=pytz.timezone('Europe/Paris')) assert i18n.format_time(d, format="hh 'o''clock' a, zzzz") == "08 o'clock AM, Pacific Daylight Time"
def test_format_datetime_with_format(): i18n.set_locale(i18n.Locale('en', 'US', timezone='America/Los_Angeles')) d = datetime.datetime(2007, 4, 1, 15, 30) assert i18n.format_datetime(d, format="yyyy.MM.dd G 'at' HH:mm:ss zzz") == "2007.04.01 AD at 16:30:00 PDT" d = datetime.datetime(2007, 4, 1, 15, 30, tzinfo=pytz.timezone('Europe/Paris')) assert i18n.format_datetime(d, format="yyyy.MM.dd G 'at' HH:mm:ss zzz") == "2007.04.01 AD at 08:21:00 PDT"
def test_format_time_datetime_with_format(self): i18n.set_locale(i18n.Locale('en', 'US', timezone='Pacific/Pitcairn')) d = datetime.datetime(2007, 4, 1, 15, 30) self.assertEqual(i18n.format_time(d, format="hh 'o''clock' a, zzzz"), u"03 o'clock PM, Pitcairn Time") tz = pytz.timezone('Africa/Niamey') d = tz.localize(datetime.datetime(2007, 4, 1, 15, 30)) self.assertEqual(i18n.format_time(d, format="hh 'o''clock' a, zzzz"), u"06 o'clock AM, Pitcairn Time")
def test_format_datetime_with_format(self): i18n.set_locale(i18n.Locale('en', 'US', timezone='Pacific/Pitcairn')) d = datetime.datetime(2007, 4, 1, 15, 30) self.assertEqual(i18n.format_datetime(d, format="yyyy.MM.dd G 'at' HH:mm:ss zzz"), '2007.04.01 AD at 15:30:00 -0800') tz = pytz.timezone('Africa/Niamey') d = tz.localize(datetime.datetime(2007, 4, 1, 15, 30)) self.assertEqual(i18n.format_datetime(d, format="yyyy.MM.dd G 'at' HH:mm:ss zzz"), '2007.04.01 AD at 06:30:00 -0800')
def set_locale(self, locale): """Set the locale of the request scope In: - ``locale`` -- the locale """ if not locale.has_translation_directory(): locale.add_translation_directory(os.path.join(self.data_path, 'locale')) i18n.set_locale(locale)
def test_get_official_languages(): set_locale(Locale('en', 'US')) assert i18n.get_official_languages() == () assert i18n.get_official_languages(de_facto=True) == ('en',) assert i18n.get_official_languages(regional=True) == ('es', 'haw') set_locale(Locale('fr', 'FR')) assert i18n.get_official_languages() == ('fr',) assert i18n.get_official_languages(de_facto=True) == ('fr',) assert i18n.get_official_languages(regional=True) == ('fr',)
def test_format_date_date(): i18n.set_locale(i18n.Locale('fr', 'FR')) d = datetime.date(2007, 4, 1) assert i18n.format_date(d, format='full') == 'dimanche 1 avril 2007' assert i18n.format_date(d, format='long') == '1 avril 2007' assert i18n.format_date(d, format='medium') == '1 avr. 2007' assert i18n.format_date(d) == '1 avr. 2007' assert i18n.format_date(d, format='short') == '01/04/2007'
def test_format_time_time_en(): i18n.set_locale(i18n.Locale('en', 'US', timezone='Pacific/Pitcairn')) t = datetime.time(15, 30) assert i18n.format_time(t, format='full') == '3:30:00 PM Pitcairn Time' assert i18n.format_time(t, format='long') == '3:30:00 PM -0800' assert i18n.format_time(t, format='medium') == '3:30:00 PM' assert i18n.format_time(t) == '3:30:00 PM' assert i18n.format_time(t, format='short') == '3:30 PM'
def test_format_time_time_fr1(self): i18n.set_locale(i18n.Locale('fr', 'FR')) t = datetime.time(15, 30) self.assertEqual(i18n.format_time(t, format='full'), '15:30:00 UTC+00:00') self.assertEqual(i18n.format_time(t, format='long'), '15:30:00 +0000') self.assertEqual(i18n.format_time(t, format='medium'), '15:30:00') self.assertEqual(i18n.format_time(t), '15:30:00') self.assertEqual(i18n.format_time(t, format='short'), '15:30')
def test_format_time_time_en(): i18n.set_locale(i18n.Locale('en', 'US', timezone='America/Los_Angeles')) t = datetime.time(15, 30) assert i18n.format_time(t, format='full') == '3:30:00 PM PT' assert i18n.format_time(t, format='long') == '3:30:00 PM PST' assert i18n.format_time(t, format='medium') == '3:30:00 PM' assert i18n.format_time(t) == '3:30:00 PM' assert i18n.format_time(t, format='short') == '3:30 PM'
def test_parse_date_en(self): i18n.set_locale(i18n.Locale('en', 'US')) d = i18n.parse_date('4/1/04') self.assertIsInstance(d, datetime.date) self.assertEqual((d.year, d.month, d.day), (2004, 4, 1)) d = i18n.parse_date('4/1/2004') self.assertIsInstance(d, datetime.date) self.assertEqual((d.year, d.month, d.day), (2004, 4, 1))
def set_locale(self, locale): """Set the locale of the request scope In: - ``locale`` -- the locale """ if locale.dirname is None: locale.dirname = os.path.join(self.data_path, 'locale') i18n.set_locale(locale)
def test_format_time_time_fr4(): i18n.set_locale(i18n.Locale('fr', 'FR', timezone='Europe/Paris')) t = datetime.time(15, 30, tzinfo=pytz.timezone('America/Los_Angeles')) assert i18n.format_time(t, format='full') == '15:30:00 HEC' assert i18n.format_time(t, format='long') == '15:30:00 HNEC' assert i18n.format_time(t, format='medium') == '15:30:00' assert i18n.format_time(t) == '15:30:00' assert i18n.format_time(t, format='short') == '15:30'
def test_format_time_datetime_fr3(): i18n.set_locale(i18n.Locale('fr', 'FR', timezone='Europe/Paris', default_timezone=pytz.UTC)) d = datetime.datetime(2007, 4, 1, 15, 30) assert i18n.format_time(d, format='full') == '17:30:00 HEC' assert i18n.format_time(d, format='long') == '17:30:00 HAEC' assert i18n.format_time(d, format='medium') == '17:30:00' assert i18n.format_time(d) == '17:30:00' assert i18n.format_time(d, format='short') == '17:30'
def test_format_time_datetime_fr4(): i18n.set_locale(i18n.Locale('fr', 'FR')) d = datetime.datetime(2007, 4, 1, 15, 30, tzinfo=pytz.timezone('America/Los_Angeles')) assert i18n.format_time(d, format='full') == '23:30:00 Monde (GMT)' assert i18n.format_time(d, format='long') == '23:30:00 +0000' assert i18n.format_time(d, format='medium') == '23:30:00' assert i18n.format_time(d) == '23:30:00' assert i18n.format_time(d, format='short') == '23:30'
def test_format_time_time_fr1(): i18n.set_locale(i18n.Locale('fr', 'FR')) t = datetime.time(15, 30) assert i18n.format_time(t, format='full') == '15:30:00 Monde (GMT)' assert i18n.format_time(t, format='long') == '15:30:00 +0000' assert i18n.format_time(t, format='medium') == '15:30:00' assert i18n.format_time(t) == '15:30:00' assert i18n.format_time(t, format='short') == '15:30'
def test_format_datetime(): i18n.set_locale(i18n.Locale('fr', 'FR', timezone='Europe/Paris')) d = datetime.datetime(2007, 4, 1, 15, 30, tzinfo=pytz.timezone('America/Los_Angeles')) assert i18n.format_datetime(d, format='full') == 'lundi 2 avril 2007 01:30:00 HEC' assert i18n.format_datetime(d, format='long') == '2 avril 2007 01:30:00 HAEC' assert i18n.format_datetime(d, format='medium') == '2 avr. 2007 01:30:00' assert i18n.format_datetime(d) == '2 avr. 2007 01:30:00' assert i18n.format_datetime(d, format='short') == '02/04/07 01:30'
def test_format_time_datetime_fr3(self): i18n.set_locale(i18n.Locale('fr', 'FR', timezone='Africa/Niamey', default_timezone=pytz.UTC)) d = datetime.datetime(2007, 4, 1, 15, 30) self.assertEqual(i18n.format_time(d, format='full'), u'16:30:00 heure normale d’Afrique de l’Ouest') self.assertEqual(i18n.format_time(d, format='long'), '16:30:00 +0100') self.assertEqual(i18n.format_time(d, format='medium'), '16:30:00') self.assertEqual(i18n.format_time(d), '16:30:00') self.assertEqual(i18n.format_time(d, format='short'), '16:30')
def test_format_time_time_fr3(): i18n.set_locale(i18n.Locale('fr', 'FR')) t = datetime.time(15, 30, tzinfo=pytz.timezone('America/Los_Angeles')) assert i18n.format_time(t, format='full') == '15:30:00 Monde (GMT)' assert i18n.format_time(t, format='long') == '15:30:00 +0000' assert i18n.format_time(t, format='medium') == '15:30:00' assert i18n.format_time(t) == '15:30:00' assert i18n.format_time(t, format='short') == '15:30'
def test_format_time_datetime_fr1(self): i18n.set_locale(i18n.Locale('fr', 'FR')) d = datetime.datetime(2007, 4, 1, 15, 30) self.assertEqual(i18n.format_time(d, format='full'), '15:30:00 UTC+00:00') self.assertEqual(i18n.format_time(d, format='long'), '15:30:00 +0000') self.assertEqual(i18n.format_time(d, format='medium'), '15:30:00') self.assertEqual(i18n.format_time(d), '15:30:00') self.assertEqual(i18n.format_time(d, format='short'), '15:30')
def test_format_time_time_fr4(self): i18n.set_locale(i18n.Locale('fr', 'FR', timezone='Africa/Niamey')) t = datetime.time(15, 30, tzinfo=pytz.timezone('Pacific/Pitcairn')) self.assertEqual(i18n.format_time(t, format='full'), u'15:30:00 heure normale d’Afrique de l’Ouest') self.assertEqual(i18n.format_time(t, format='long'), '15:30:00 +0100') self.assertEqual(i18n.format_time(t, format='medium'), '15:30:00') self.assertEqual(i18n.format_time(t), '15:30:00') self.assertEqual(i18n.format_time(t, format='short'), '15:30')
def test_format_time_time_en(self): i18n.set_locale(i18n.Locale('en', 'US', timezone='Pacific/Pitcairn')) t = datetime.time(15, 30) self.assertEqual(i18n.format_time(t, format='full'), '3:30:00 PM Pitcairn Time') self.assertEqual(i18n.format_time(t, format='long'), '3:30:00 PM -0800') self.assertEqual(i18n.format_time(t, format='medium'), '3:30:00 PM') self.assertEqual(i18n.format_time(t), '3:30:00 PM') self.assertEqual(i18n.format_time(t, format='short'), '3:30 PM')
def test_parse_date_en(): i18n.set_locale(i18n.Locale('en', 'US')) d = i18n.parse_date('4/1/04') assert isinstance(d, datetime.date) assert (d.year, d.month, d.day) == (2004, 4, 1) d = i18n.parse_date('4/1/2004') assert isinstance(d, datetime.date) assert (d.year, d.month, d.day) == (2004, 4, 1)
def test_format_time_time_fr3(self): i18n.set_locale(i18n.Locale('fr', 'FR')) t = datetime.time(15, 30, tzinfo=pytz.timezone('Pacific/Pitcairn')) self.assertEqual(i18n.format_time(t, format='full'), '15:30:00 UTC+00:00') self.assertEqual(i18n.format_time(t, format='long'), '15:30:00 +0000') self.assertEqual(i18n.format_time(t, format='medium'), '15:30:00') self.assertEqual(i18n.format_time(t), '15:30:00') self.assertEqual(i18n.format_time(t, format='short'), '15:30')
def test_format_time_time_fr2(): i18n.set_locale(i18n.Locale('fr', 'FR', timezone='Europe/Paris')) t = datetime.time(15, 30) assert i18n.format_time(t, format='full') == '15:30:00 HEC' assert i18n.format_time(t, format='long') == '15:30:00 HNEC' assert i18n.format_time(t, format='medium') == '15:30:00' assert i18n.format_time(t) == '15:30:00' assert i18n.format_time(t, format='short') == '15:30'
def test_parse_date_fr(): i18n.set_locale(i18n.Locale('fr', 'FR')) d = i18n.parse_date('4/1/04') assert isinstance(d, datetime.date) assert (d.year, d.month, d.day) == (2004, 1, 4) d = i18n.parse_date('4/1/2004') assert isinstance(d, datetime.date) assert (d.year, d.month, d.day) == (2004, 1, 4)
def test_format_time_datetime_fr1(): i18n.set_locale(i18n.Locale('fr', 'FR')) d = datetime.datetime(2007, 4, 1, 15, 30) assert i18n.format_time(d, format='full') == '15:30:00 Monde (GMT)' assert i18n.format_time(d, format='long') == '15:30:00 +0000' assert i18n.format_time(d, format='medium') == '15:30:00' assert i18n.format_time(d) == '15:30:00' assert i18n.format_time(d, format='short') == '15:30'
def test_format_time_datetime_fr2(self): i18n.set_locale(i18n.Locale('fr', 'FR', timezone='Africa/Niamey')) d = datetime.datetime(2007, 4, 1, 15, 30) self.assertEqual(i18n.format_time(d, format='full'), u'15:30:00 heure normale d’Afrique de l’Ouest') self.assertEqual(i18n.format_time(d, format='long'), '15:30:00 +0100') self.assertEqual(i18n.format_time(d, format='medium'), '15:30:00') self.assertEqual(i18n.format_time(d), '15:30:00') self.assertEqual(i18n.format_time(d, format='short'), '15:30')
def test_format_datetime_with_format(): i18n.set_locale(i18n.Locale('en', 'US', timezone='Pacific/Pitcairn')) d = datetime.datetime(2007, 4, 1, 15, 30) assert i18n.format_datetime(d, format="yyyy.MM.dd G 'at' HH:mm:ss zzz" ) == '2007.04.01 AD at 15:30:00 -0800' tz = pytz.timezone('Africa/Niamey') d = tz.localize(datetime.datetime(2007, 4, 1, 15, 30)) assert i18n.format_datetime(d, format="yyyy.MM.dd G 'at' HH:mm:ss zzz" ) == '2007.04.01 AD at 06:30:00 -0800'
def test_format_datetime(self): i18n.set_locale(i18n.Locale('fr', 'FR', timezone='Africa/Niamey')) tz = pytz.timezone('Pacific/Pitcairn') d = tz.localize(datetime.datetime(2007, 4, 1, 15, 30)) self.assertEqual(i18n.format_datetime(d, format='full'), u'lundi 2 avril 2007 à 00:30:00 heure normale d’Afrique de l’Ouest') self.assertEqual(i18n.format_datetime(d, format='long'), u'2 avril 2007 à 00:30:00 +0100') self.assertEqual(i18n.format_datetime(d, format='medium'), u'2 avr. 2007 à 00:30:00') self.assertEqual(i18n.format_datetime(d), u'2 avr. 2007 à 00:30:00') self.assertEqual(i18n.format_datetime(d, format='short'), '02/04/2007 00:30')
def test_format_time_time_fr2(): i18n.set_locale(i18n.Locale('fr', 'FR', timezone='Africa/Niamey')) t = datetime.time(15, 30) assert i18n.format_time( t, format='full') == u'15:30:00 heure normale d’Afrique de l’Ouest' assert i18n.format_time(t, format='long') == '15:30:00 +0100' assert i18n.format_time(t, format='medium') == '15:30:00' assert i18n.format_time(t) == '15:30:00' assert i18n.format_time(t, format='short') == '15:30'
def test_format_date_datetime(): i18n.set_locale(i18n.Locale('fr', 'FR')) tz = pytz.timezone('Pacific/Pitcairn') d = tz.localize(datetime.datetime(2007, 4, 1, 15, 30)) assert i18n.format_date(d, format='full') == 'dimanche 1 avril 2007' assert i18n.format_date(d, format='long') == '1 avril 2007' assert i18n.format_date(d, format='medium') == '1 avr. 2007' assert i18n.format_date(d) == '1 avr. 2007' assert i18n.format_date(d, format='short') == '01/04/2007'
def test_format_time_datetime_fr4(self): i18n.set_locale(i18n.Locale('fr', 'FR')) tz = pytz.timezone('Pacific/Pitcairn') d = tz.localize(datetime.datetime(2007, 4, 1, 15, 30)) self.assertEqual(i18n.format_time(d, format='full'), '23:30:00 UTC+00:00') self.assertEqual(i18n.format_time(d, format='long'), '23:30:00 +0000') self.assertEqual(i18n.format_time(d, format='medium'), '23:30:00') self.assertEqual(i18n.format_time(d), '23:30:00') self.assertEqual(i18n.format_time(d, format='short'), '23:30')
def set_locale(self, locale): """Set the locale of the request scope In: - ``locale`` -- the locale """ if not locale.has_translation_directory(): locale.add_translation_directory( os.path.join(self.data_path, 'locale')) i18n.set_locale(locale)
def test_format_time_time_fr3(): i18n.set_locale(i18n.Locale('fr', 'FR')) t = datetime.time(15, 30, tzinfo=pytz.timezone('Pacific/Pitcairn')) assert i18n.format_time( t, format='full') == u'15:30:00 Temps universel coordonné' assert i18n.format_time(t, format='long') == '15:30:00 TU' assert i18n.format_time(t, format='medium') == '15:30:00' assert i18n.format_time(t) == '15:30:00' assert i18n.format_time(t, format='short') == '15:30'
def test_context_manager(): locale1 = i18n.Locale('fr', 'FR', domain='domain1') locale2 = i18n.Locale('fr', 'FR', domain='domain2') i18n.set_locale(locale1) assert i18n.get_locale().domain == 'domain1', i18n.get_locale().domain with locale2: assert i18n.get_locale().domain == 'domain2', i18n.get_locale().domain with locale2: assert i18n.get_locale().domain == 'domain2', i18n.get_locale().domain assert i18n.get_locale().domain == 'domain1', i18n.get_locale().domain
def test_format_time_datetime_fr1(): i18n.set_locale(i18n.Locale('fr', 'FR')) d = datetime.datetime(2007, 4, 1, 15, 30) assert i18n.format_time( d, format='full') == u'15:30:00 Temps universel coordonné' assert i18n.format_time(d, format='long') == '15:30:00 TU' assert i18n.format_time(d, format='medium') == '15:30:00' assert i18n.format_time(d) == '15:30:00' assert i18n.format_time(d, format='short') == '15:30'
def test_format_time_datetime_fr5(self): i18n.set_locale(i18n.Locale('fr', 'FR', timezone='Africa/Niamey')) tz = pytz.timezone('Pacific/Pitcairn') d = tz.localize(datetime.datetime(2007, 4, 1, 15, 30)) self.assertEqual(i18n.format_time(d, format='full'), u'00:30:00 heure normale d’Afrique de l’Ouest') self.assertEqual(i18n.format_time(d, format='long'), '00:30:00 +0100') self.assertEqual(i18n.format_time(d, format='medium'), '00:30:00') self.assertEqual(i18n.format_time(d), '00:30:00') self.assertEqual(i18n.format_time(d, format='short'), '00:30')
def test_format_time_datetime_fr4(): i18n.set_locale(i18n.Locale('fr', 'FR')) tz = pytz.timezone('Pacific/Pitcairn') d = tz.localize(datetime.datetime(2007, 4, 1, 15, 30)) assert i18n.format_time( d, format='full') == u'23:30:00 Temps universel coordonné' assert i18n.format_time(d, format='long') == '23:30:00 TU' assert i18n.format_time(d, format='medium') == '23:30:00' assert i18n.format_time(d) == '23:30:00' assert i18n.format_time(d, format='short') == '23:30'
def test_context_manager(): locale1 = i18n.Locale('fr', 'FR', domain='domain1') locale2 = i18n.Locale('fr', 'FR', domain='domain2') i18n.set_locale(locale1) assert i18n.get_locale().domain == 'domain1' with locale2: assert i18n.get_locale().domain == 'domain2' with locale2: assert i18n.get_locale().domain == 'domain2' assert i18n.get_locale().domain == 'domain1'
def test_context_manager(self): locale1 = i18n.Locale('fr', 'FR', domain='domain1') locale2 = i18n.Locale('fr', 'FR', domain='domain2') i18n.set_locale(locale1) self.assertEqual(i18n.get_locale().domain, 'domain1') with locale2: self.assertEqual(i18n.get_locale().domain, 'domain2') with locale2: self.assertEqual(i18n.get_locale().domain, 'domain2') self.assertEqual(i18n.get_locale().domain, 'domain1')
def test_get_territory_currencies(): set_locale(Locale(territory='AT')) assert i18n.get_territory_currencies(datetime.date(1995, 1, 1), datetime.date(2011, 1, 1)) == ['ATS', 'EUR'] assert i18n.get_territory_currencies(datetime.date(1995, 1, 1)) == ['ATS'] assert i18n.get_territory_currencies(datetime.date(2011, 1, 1)) == ['EUR'] set_locale(Locale('en', 'US')) assert i18n.get_territory_currencies() == ['USD'] assert i18n.get_territory_currencies(tender=False, non_tender=True, start_date=datetime.date( 2014, 1, 1)) == ['USN', 'USS']
def test_get_timezone_gmt(self): utc_date = datetime.datetime(2007, 4, 1, 15, 30) tz = pytz.timezone('Pacific/Pitcairn') d = Locale('en', timezone=tz).to_timezone(utc_date) self.assertEqual(i18n.get_timezone_gmt(d, width='long'), u'UTC-08:00') self.assertEqual(i18n.get_timezone_gmt(d), u'UTC-08:00') self.assertEqual(i18n.get_timezone_gmt(d, width='short'), '-0800') i18n.set_locale(i18n.Locale('en', 'US')) self.assertEqual(i18n.get_timezone_gmt(d, width='long'), u'GMT-08:00') self.assertEqual(i18n.get_timezone_gmt(d), u'GMT-08:00') self.assertEqual(i18n.get_timezone_gmt(d, width='short'), '-0800')
def test_format_datetime(): i18n.set_locale(i18n.Locale('fr', 'FR', timezone='Africa/Niamey')) tz = pytz.timezone('Pacific/Pitcairn') d = tz.localize(datetime.datetime(2007, 4, 1, 15, 30)) assert i18n.format_datetime( d, format='full' ) == u'lundi 2 avril 2007 à 00:30:00 heure normale d’Afrique de l’Ouest' assert i18n.format_datetime( d, format='long') == u'2 avril 2007 à 00:30:00 +0100' assert i18n.format_datetime(d, format='medium') == u'2 avr. 2007 à 00:30:00' assert i18n.format_datetime(d) == u'2 avr. 2007 à 00:30:00' assert i18n.format_datetime(d, format='short') == '02/04/2007 00:30'