]> granicus.if.org Git - python/commitdiff
Fix r85728: use "" to mean the system default locale, which should work on more systems.
authorGeorg Brandl <georg@python.org>
Wed, 20 Oct 2010 06:50:19 +0000 (06:50 +0000)
committerGeorg Brandl <georg@python.org>
Wed, 20 Oct 2010 06:50:19 +0000 (06:50 +0000)
Lib/test/test_calendar.py

index f906bc39bd60e927a6f5ab1351e56c935957dddc..9ba7f0c071a67e5ab990b94d81954315a5964f46 100644 (file)
@@ -254,16 +254,13 @@ class CalendarTestCase(unittest.TestCase):
     def test_localecalendars(self):
         # ensure that Locale{Text,HTML}Calendar resets the locale properly
         # (it is still not thread-safe though)
+        old_october = calendar.TextCalendar().formatmonthname(2010, 10, 10)
         try:
-            def_locale = locale.getdefaultlocale()
+            calendar.LocaleTextCalendar(locale='').formatmonthname(2010, 10, 10)
         except locale.Error:
-            # cannot determine a default locale -- skip test
+            # cannot set the system default locale -- skip rest of test
             return
-        old_october = calendar.TextCalendar().formatmonthname(2010, 10, 10)
-        calendar.LocaleTextCalendar(
-            locale=def_locale).formatmonthname(2010, 10, 10)
-        calendar.LocaleHTMLCalendar(
-            locale=def_locale).formatmonthname(2010, 10)
+        calendar.LocaleHTMLCalendar(locale='').formatmonthname(2010, 10)
         new_october = calendar.TextCalendar().formatmonthname(2010, 10, 10)
         self.assertEquals(old_october, new_october)