diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2013-07-06 11:32:01 +0200 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2013-07-06 11:32:01 +0200 |
commit | 08d3b14b5d0fd6686c8c66d87322a61d94f651c9 (patch) | |
tree | 46a9c0da1c310ac38c62b1ba962875736e238ceb | |
parent | eccab7afd7b8846b35b91742b2e30f7ceda1da97 (diff) | |
download | babel-08d3b14b5d0fd6686c8c66d87322a61d94f651c9.tar.gz |
Fixed timezone test breakages and a few other small things
-rw-r--r-- | babel/dates.py | 23 | ||||
-rwxr-xr-x | scripts/import_cldr.py | 1 | ||||
-rwxr-xr-x | setup.py | 4 |
3 files changed, 12 insertions, 16 deletions
diff --git a/babel/dates.py b/babel/dates.py index e667af7..562abf1 100644 --- a/babel/dates.py +++ b/babel/dates.py @@ -306,7 +306,7 @@ def get_timezone_location(dt_or_tzinfo=None, locale=LC_TIME): If the timezone is associated with a country that uses only a single timezone, just the localized country name is returned: - >>> tz = timezone('Europe/Berlin') + >>> tz = get_timezone('Europe/Berlin') >>> get_timezone_name(tz, locale='de_DE') u'Mitteleurop\\xe4ische Zeit' @@ -387,7 +387,7 @@ def get_timezone_name(dt_or_tzinfo=None, width='long', uncommon=False, time. This can be used for example for selecting timezones, or to set the time of events that recur across DST changes: - >>> tz = timezone('America/Los_Angeles') + >>> tz = get_timezone('America/Los_Angeles') >>> get_timezone_name(tz, locale='en_US') u'Pacific Time' >>> get_timezone_name(tz, 'short', locale='en_US') @@ -397,7 +397,7 @@ def get_timezone_name(dt_or_tzinfo=None, width='long', uncommon=False, is associated with a country that uses only a single timezone, the name of that country is returned, formatted according to the locale: - >>> tz = timezone('Europe/Berlin') + >>> tz = get_timezone('Europe/Berlin') >>> get_timezone_name(tz, locale='de_DE') u'Mitteleurop\xe4ische Zeit' >>> get_timezone_name(tz, locale='pt_BR') @@ -406,7 +406,7 @@ def get_timezone_name(dt_or_tzinfo=None, width='long', uncommon=False, On the other hand, if the country uses multiple timezones, the city is also included in the representation: - >>> tz = timezone('America/St_Johns') + >>> tz = get_timezone('America/St_Johns') >>> get_timezone_name(tz, locale='de_DE') u'Neufundland-Zeit' @@ -533,7 +533,7 @@ def format_datetime(datetime=None, format='medium', tzinfo=None, ... locale='fr_FR') u'dimanche 1 avril 2007 17:30:00 heure avanc\xe9e d\u2019Europe centrale' >>> format_datetime(dt, "yyyy.MM.dd G 'at' HH:mm:ss zzz", - ... tzinfo=timezone('US/Eastern'), locale='en') + ... tzinfo=get_timezone('US/Eastern'), locale='en') u'2007.04.01 AD at 11:30:00 EDT' :param datetime: the `datetime` object; if `None`, the current date and @@ -582,16 +582,15 @@ def format_time(time=None, format='medium', tzinfo=None, locale=LC_TIME): >>> format_time(t, "hh 'o''clock' a", locale='en') u"03 o'clock PM" - For any pattern requiring the display of the time-zone, the third-party - ``pytz`` package is needed to explicitly specify the time-zone: + For any pattern requiring the display of the time-zone a + timezone has to be specified explicitly: - >>> from pytz import timezone >>> t = datetime(2007, 4, 1, 15, 30) - >>> tzinfo = timezone('Europe/Paris') + >>> tzinfo = get_timezone('Europe/Paris') >>> t = tzinfo.localize(t) >>> format_time(t, format='full', tzinfo=tzinfo, locale='fr_FR') u'15:30:00 heure avanc\xe9e d\u2019Europe centrale' - >>> format_time(t, "hh 'o''clock' a, zzzz", tzinfo=timezone('US/Eastern'), + >>> format_time(t, "hh 'o''clock' a, zzzz", tzinfo=get_timezone('US/Eastern'), ... locale='en') u"09 o'clock AM, Eastern Daylight Time" @@ -609,10 +608,10 @@ def format_time(time=None, format='medium', tzinfo=None, locale=LC_TIME): parameter is only used to display the timezone name if needed: >>> t = time(15, 30) - >>> format_time(t, format='full', tzinfo=timezone('Europe/Paris'), + >>> format_time(t, format='full', tzinfo=get_timezone('Europe/Paris'), ... locale='fr_FR') u'15:30:00 heure normale de l\u2019Europe centrale' - >>> format_time(t, format='full', tzinfo=timezone('US/Eastern'), + >>> format_time(t, format='full', tzinfo=get_timezone('US/Eastern'), ... locale='en_US') u'3:30:00 PM Eastern Standard Time' diff --git a/scripts/import_cldr.py b/scripts/import_cldr.py index fbf9f9b..60aeace 100755 --- a/scripts/import_cldr.py +++ b/scripts/import_cldr.py @@ -23,7 +23,6 @@ from xml.etree import ElementTree sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), '..')) from babel import dates, numbers -from babel.compat import any from babel.plural import PluralRule from babel.localedata import Alias @@ -76,7 +76,5 @@ setup( ignore = babel.messages.extract:extract_nothing python = babel.messages.extract:extract_python javascript = babel.messages.extract:extract_javascript - """, - - **extra_arguments + """ ) |