diff options
Diffstat (limited to 'Lib/test/test_calendar.py')
-rw-r--r-- | Lib/test/test_calendar.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py index e8b2ca5..a4839a6 100644 --- a/Lib/test/test_calendar.py +++ b/Lib/test/test_calendar.py @@ -2,6 +2,7 @@ import calendar import unittest from test import support +import locale result_2004_text = """ @@ -250,6 +251,19 @@ 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) + old_october = calendar.TextCalendar().formatmonthname(2010, 10, 10) + try: + calendar.LocaleTextCalendar(locale='').formatmonthname(2010, 10, 10) + except locale.Error: + # cannot set the system default locale -- skip rest of test + return + calendar.LocaleHTMLCalendar(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): |