diff options
Diffstat (limited to 'Lib/test/test_calendar.py')
-rw-r--r-- | Lib/test/test_calendar.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py index b936acb..f906bc3 100644 --- a/Lib/test/test_calendar.py +++ b/Lib/test/test_calendar.py @@ -3,6 +3,7 @@ import unittest from test import support import time +import locale result_2004_text = """ 2004 @@ -250,6 +251,22 @@ class CalendarTestCase(unittest.TestCase): # verify it "acts like a sequence" in two forms of iteration self.assertEqual(value[::-1], list(reversed(value))) + def test_localecalendars(self): + # ensure that Locale{Text,HTML}Calendar resets the locale properly + # (it is still not thread-safe though) + try: + def_locale = locale.getdefaultlocale() + except locale.Error: + # cannot determine a default locale -- skip 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) + new_october = calendar.TextCalendar().formatmonthname(2010, 10, 10) + self.assertEquals(old_october, new_october) + class MonthCalendarTestCase(unittest.TestCase): def setUp(self): |