]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
cldr: use CLDR 31.0.1 (and fix test changes); see below! 456/head
authorAarni Koskela <akx@iki.fi>
Fri, 18 Aug 2017 10:14:46 +0000 (13:14 +0300)
committerAarni Koskela <akx@iki.fi>
Wed, 17 Jan 2018 07:18:50 +0000 (09:18 +0200)
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.

babel/core.py
scripts/download_import_cldr.py
tests/test_core.py
tests/test_dates.py
tests/test_languages.py
tests/test_numbers.py

index c8b18021404c38c651aa63cb4de9b418ea2aca3a..5a9091faeab607332dc83e80a37ab74d5ee46ccf 100644 (file)
@@ -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'
 
index 9914a113e27df0c905104a56420e514f518c0a9b..61b2773267720061dc9cbc79c8f3f6f6e7b085f9 100755 (executable)
@@ -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):
index e3d8faffa4464643f7c8dd624bdfc82e70b713bd..4f985ca74997c04e684b18795de261753ed8b970 100644 (file)
@@ -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'
 
 
index f74cd396dee81ff1a81777f41e2f3f723f0f51ae..9a01d985ea4d3e57173de229317893559d1c09df 100644 (file)
@@ -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():
index 23af26d532fc1e0780585bb0dfec173e1989decc..32f0d67d56f043fb4d8f7e9181278b070a066801 100644 (file)
@@ -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"}
+    )
index d9ca991ec194c7eb637a2c25a3001e6ff4f6ecd7..83990058c3a9342d16155b04d0a8f2c8adde42e9 100644 (file)
@@ -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