]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Fixed a bunch of broken timezone tests.
authorArmin Ronacher <armin.ronacher@active-4.com>
Mon, 27 Jul 2015 11:22:31 +0000 (13:22 +0200)
committerArmin Ronacher <armin.ronacher@active-4.com>
Mon, 27 Jul 2015 11:22:31 +0000 (13:22 +0200)
babel/dates.py
tests/test_dates.py

index 73d54fa573c339f9d9326fbefa085f1d8b9c42f0..6761bcae1089ab820bc385b67b4a023c6a03c7e3 100644 (file)
@@ -281,17 +281,17 @@ def get_timezone_gmt(datetime=None, width='long', locale=LC_TIME):
     u'GMT+00:00'
 
     >>> tz = get_timezone('America/Los_Angeles')
-    >>> dt = datetime(2007, 4, 1, 15, 30, tzinfo=tz)
+    >>> dt = tz.localize(datetime(2007, 4, 1, 15, 30))
     >>> get_timezone_gmt(dt, locale='en')
-    u'GMT-08:00'
+    u'GMT-07:00'
     >>> get_timezone_gmt(dt, 'short', locale='en')
-    u'-0800'
+    u'-0700'
 
     The long format depends on the locale, for example in France the acronym
     UTC string is used instead of GMT:
 
     >>> get_timezone_gmt(dt, 'long', locale='fr_FR')
-    u'UTC-08:00'
+    u'UTC-07:00'
 
     .. versionadded:: 0.9
 
index 7b897a13abdd774d710bd7448db9918a945ba2e2..25719299abb0e8bbd8e64d3a9f1fa463d4d11663 100644 (file)
@@ -177,19 +177,19 @@ class DateTimeFormatTestCase(unittest.TestCase):
 
     def test_timezone_rfc822(self):
         tz = timezone('Europe/Berlin')
-        t = time(15, 30, tzinfo=tz)
+        t = tz.localize(datetime(2015, 1, 1, 15, 30))
         fmt = dates.DateTimeFormat(t, locale='de_DE')
         self.assertEqual('+0100', fmt['Z'])
 
     def test_timezone_gmt(self):
         tz = timezone('Europe/Berlin')
-        t = time(15, 30, tzinfo=tz)
+        t = tz.localize(datetime(2015, 1, 1, 15, 30))
         fmt = dates.DateTimeFormat(t, locale='de_DE')
         self.assertEqual('GMT+01:00', fmt['ZZZZ'])
 
     def test_timezone_name(self):
         tz = timezone('Europe/Paris')
-        dt = datetime(2007, 4, 1, 15, 30, tzinfo=tz)
+        dt = tz.localize(datetime(2007, 4, 1, 15, 30))
         fmt = dates.DateTimeFormat(dt, locale='fr_FR')
         self.assertEqual('Heure : France', fmt['v'])
 
@@ -380,11 +380,11 @@ def test_get_timezone_gmt():
     assert dates.get_timezone_gmt(dt, locale='en') == u'GMT+00:00'
 
     tz = timezone('America/Los_Angeles')
-    dt = datetime(2007, 4, 1, 15, 30, tzinfo=tz)
-    assert dates.get_timezone_gmt(dt, locale='en') == u'GMT-08:00'
-    assert dates.get_timezone_gmt(dt, 'short', locale='en') == u'-0800'
+    dt = tz.localize(datetime(2007, 4, 1, 15, 30))
+    assert dates.get_timezone_gmt(dt, locale='en') == u'GMT-07:00'
+    assert dates.get_timezone_gmt(dt, 'short', locale='en') == u'-0700'
 
-    assert dates.get_timezone_gmt(dt, 'long', locale='fr_FR') == u'UTC-08:00'
+    assert dates.get_timezone_gmt(dt, 'long', locale='fr_FR') == u'UTC-07:00'
 
 
 def test_get_timezone_location():