From: Aarni Koskela Date: Fri, 18 Aug 2017 10:14:46 +0000 (+0300) Subject: cldr: use CLDR 31.0.1 (and fix test changes); see below! X-Git-Tag: v2.6.0~11^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F456%2Fhead;p=thirdparty%2Fbabel.git cldr: use CLDR 31.0.1 (and fix test changes); see below! CLDR 31.0 separated the GMT and UTC time zones, so formatting of that time zone has changed. Most notably, "UTC" replaces "+0000" when formatting the timezone. This could break code that expects +0000. A subset (the parts supported by Babel) of the migration guide from http://cldr.unicode.org/index/downloads/cldr-31: * The locales in the language-territory population tables have been changed to be the canonical format, dropping the script where it is the default. So "ku_Latn" changes to "ku". * Plural rules: The Portuguese plural rules have changed so that all (and only) integers and decimal fractions < 2 are singular. * Timezones: The GMT timezone has been split from the UTC timezone. * Timezones: New timezone bcp47 codes have been added. * Languages "hr" and "sr" are no longer a short distance apart, for political reasons. * The primary names for CZ changed from "Czech Republic" to "Czechia", with the longer name now the alternate. --- diff --git a/babel/core.py b/babel/core.py index c8b18021..5a9091fa 100644 --- a/babel/core.py +++ b/babel/core.py @@ -39,7 +39,7 @@ def get_global(key): information independent of individual locales. >>> get_global('zone_aliases')['UTC'] - u'Etc/GMT' + u'Etc/UTC' >>> get_global('zone_territories')['Europe/Berlin'] u'DE' diff --git a/scripts/download_import_cldr.py b/scripts/download_import_cldr.py index 9914a113..61b27732 100755 --- a/scripts/download_import_cldr.py +++ b/scripts/download_import_cldr.py @@ -13,9 +13,9 @@ except ImportError: from urllib import urlretrieve -URL = 'http://unicode.org/Public/cldr/30.0.2/core.zip' -FILENAME = 'core-30.0.2.zip' -FILESUM = '7d21d5f34a2b94f78f737d9279bcaae85ccc5332' +URL = 'http://www.unicode.org/Public/cldr/31.0.1/core.zip' +FILENAME = 'core-31.0.1.zip' +FILESUM = '01ade6c2d1f358e63c2ab6e2861d4caa7114ff45' BLKSIZE = 131072 @@ -82,7 +82,7 @@ def main(): os.remove(zip_path) urlretrieve(URL, zip_path, reporthook) changed = True - print + print() common_path = os.path.join(cldr_path, 'common') if changed or not os.path.isdir(common_path): diff --git a/tests/test_core.py b/tests/test_core.py index e3d8faff..4f985ca7 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -58,7 +58,8 @@ def test_ignore_invalid_locales_in_lc_ctype(os_environ): def test_get_global(): - assert core.get_global('zone_aliases')['UTC'] == 'Etc/GMT' + assert core.get_global('zone_aliases')['GMT'] == 'Etc/GMT' + assert core.get_global('zone_aliases')['UTC'] == 'Etc/UTC' assert core.get_global('zone_territories')['Europe/Berlin'] == 'DE' diff --git a/tests/test_dates.py b/tests/test_dates.py index f74cd396..9a01d985 100644 --- a/tests/test_dates.py +++ b/tests/test_dates.py @@ -292,7 +292,7 @@ class FormatDatetimeTestCase(unittest.TestCase): d = datetime(2012, 4, 1, 15, 30, 29, tzinfo=timezone('UTC')) epoch = float(calendar.timegm(d.timetuple())) formatted_string = dates.format_datetime(epoch, format='long', locale='en_US') - self.assertEqual(u'April 1, 2012 at 3:30:29 PM +0000', formatted_string) + self.assertEqual(u'April 1, 2012 at 3:30:29 PM UTC', formatted_string) def test_timezone_formats(self): dt = datetime(2016, 1, 13, 7, 8, 35) @@ -358,9 +358,9 @@ class FormatDatetimeTestCase(unittest.TestCase): formatted_string = dates.format_datetime(dt, 'OOOO', locale='en') self.assertEqual(u'GMT+00:00', formatted_string) formatted_string = dates.format_datetime(dt, 'VV', locale='en') - self.assertEqual(u'Etc/GMT', formatted_string) + self.assertEqual(u'Etc/UTC', formatted_string) formatted_string = dates.format_datetime(dt, 'VVV', locale='en') - self.assertEqual(u'GMT', formatted_string) + self.assertEqual(u'UTC', formatted_string) formatted_string = dates.format_datetime(dt, 'X', locale='en') self.assertEqual(u'Z', formatted_string) formatted_string = dates.format_datetime(dt, 'XX', locale='en') @@ -430,7 +430,7 @@ class FormatTimeTestCase(unittest.TestCase): d = datetime(2012, 4, 1, 15, 30, 29, tzinfo=timezone('UTC')) epoch = float(calendar.timegm(d.timetuple())) formatted_time = dates.format_time(epoch, format='long', locale='en_US') - self.assertEqual(u'3:30:29 PM +0000', formatted_time) + self.assertEqual(u'3:30:29 PM UTC', formatted_time) def test_with_date_fields_in_pattern(self): self.assertRaises(AttributeError, dates.format_time, date(2007, 4, 1), @@ -511,7 +511,7 @@ class TimeZoneAdjustTestCase(unittest.TestCase): utc = self._utc() t = datetime(2007, 4, 1, 15, 30, tzinfo=utc) formatted_time = dates.format_time(t, 'long', tzinfo=utc, locale='en') - self.assertEqual('3:30:00 PM +0000', formatted_time) + self.assertEqual('3:30:00 PM UTC', formatted_time) def test_get_period_names(): @@ -633,8 +633,8 @@ def test_get_timezone_name(): assert (dates.get_timezone_name('Europe/Berlin', locale='en_US') == "Central European Time") - assert (dates.get_timezone_name(1400000000, locale='en_US', width='short') == "Unknown Region (GMT) Time") - assert (dates.get_timezone_name(time(16, 20), locale='en_US', width='short') == "+0000") + assert (dates.get_timezone_name(1400000000, locale='en_US', width='short') == "Unknown Region (UTC) Time") + assert (dates.get_timezone_name(time(16, 20), locale='en_US', width='short') == "UTC") def test_format_date(): diff --git a/tests/test_languages.py b/tests/test_languages.py index 23af26d5..32f0d67d 100644 --- a/tests/test_languages.py +++ b/tests/test_languages.py @@ -11,6 +11,7 @@ def test_official_languages(): def test_get_language_info(): - assert set(get_territory_language_info("HU").keys()) == {"hu", "en", "de", - "ro", "hr", "sk", - "sl"} + assert ( + set(get_territory_language_info("HU")) == + {"hu", "fr", "en", "de", "ro", "hr", "sk", "sl"} + ) diff --git a/tests/test_numbers.py b/tests/test_numbers.py index d9ca991e..83990058 100644 --- a/tests/test_numbers.py +++ b/tests/test_numbers.py @@ -180,7 +180,7 @@ def test_list_currencies(): assert list_currencies(locale='pa_Arab') == {'PKR', 'INR', 'EUR'} assert list_currencies(locale='kok') == set([]) - assert len(list_currencies()) == 296 + assert len(list_currencies()) == 297 def test_validate_currency(): @@ -593,4 +593,4 @@ def test_numberpattern_repr(): def test_parse_static_pattern(): assert numbers.parse_pattern('Kun') # in the So locale in CLDR 30 - # TODO: static patterns might not be correctly `apply()`ed at present \ No newline at end of file + # TODO: static patterns might not be correctly `apply()`ed at present