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)