[Python-checkins] r85735 - python/branches/py3k/Lib/test/test_calendar.py

georg.brandl python-checkins at python.org
Wed Oct 20 08:50:20 CEST 2010


Author: georg.brandl
Date: Wed Oct 20 08:50:19 2010
New Revision: 85735

Log:
Fix r85728: use "" to mean the system default locale, which should work on more systems.

Modified:
   python/branches/py3k/Lib/test/test_calendar.py

Modified: python/branches/py3k/Lib/test/test_calendar.py
==============================================================================
--- python/branches/py3k/Lib/test/test_calendar.py	(original)
+++ python/branches/py3k/Lib/test/test_calendar.py	Wed Oct 20 08:50:19 2010
@@ -254,16 +254,13 @@
     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)
 


More information about the Python-checkins mailing list