summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_calendar.py14
-rw-r--r--Lib/test/test_rlcompleter.py4
2 files changed, 16 insertions, 2 deletions
diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py
index e8b2ca5482..a4839a682b 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):
diff --git a/Lib/test/test_rlcompleter.py b/Lib/test/test_rlcompleter.py
index 29e6a1b2e7..11a7bd2f71 100644
--- a/Lib/test/test_rlcompleter.py
+++ b/Lib/test/test_rlcompleter.py
@@ -31,9 +31,9 @@ class TestRlcompleter(unittest.TestCase):
def test_global_matches(self):
# test with builtins namespace
- self.assertEqual(self.stdcompleter.global_matches('di'),
+ self.assertEqual(sorted(self.stdcompleter.global_matches('di')),
[x+'(' for x in dir(builtins) if x.startswith('di')])
- self.assertEqual(self.stdcompleter.global_matches('st'),
+ self.assertEqual(sorted(self.stdcompleter.global_matches('st')),
[x+'(' for x in dir(builtins) if x.startswith('st')])
self.assertEqual(self.stdcompleter.global_matches('akaksajadhak'), [])