mirror of
https://github.com/python/cpython.git
synced 2025-07-13 14:25:18 +00:00
Increased test coverage of calendar module
This commit is contained in:
parent
4082c8e298
commit
cb0523e67c
1 changed files with 5 additions and 2 deletions
|
@ -546,17 +546,20 @@ class CalendarTestCase(unittest.TestCase):
|
||||||
# (it is still not thread-safe though)
|
# (it is still not thread-safe though)
|
||||||
old_october = calendar.TextCalendar().formatmonthname(2010, 10, 10)
|
old_october = calendar.TextCalendar().formatmonthname(2010, 10, 10)
|
||||||
try:
|
try:
|
||||||
cal = calendar.LocaleTextCalendar(locale='')
|
cal = calendar.LocaleTextCalendar(locale=None)
|
||||||
local_weekday = cal.formatweekday(1, 10)
|
local_weekday = cal.formatweekday(1, 10)
|
||||||
|
local_weekday_abbr = cal.formatweekday(1, 3)
|
||||||
local_month = cal.formatmonthname(2010, 10, 10)
|
local_month = cal.formatmonthname(2010, 10, 10)
|
||||||
except locale.Error:
|
except locale.Error:
|
||||||
# cannot set the system default locale -- skip rest of test
|
# cannot set the system default locale -- skip rest of test
|
||||||
raise unittest.SkipTest('cannot set the system default locale')
|
raise unittest.SkipTest('cannot set the system default locale')
|
||||||
self.assertIsInstance(local_weekday, str)
|
self.assertIsInstance(local_weekday, str)
|
||||||
|
self.assertIsInstance(local_weekday_abbr, str)
|
||||||
self.assertIsInstance(local_month, str)
|
self.assertIsInstance(local_month, str)
|
||||||
self.assertEqual(len(local_weekday), 10)
|
self.assertEqual(len(local_weekday), 10)
|
||||||
|
self.assertEqual(len(local_weekday_abbr), 3)
|
||||||
self.assertGreaterEqual(len(local_month), 10)
|
self.assertGreaterEqual(len(local_month), 10)
|
||||||
cal = calendar.LocaleHTMLCalendar(locale='')
|
cal = calendar.LocaleHTMLCalendar(locale=None)
|
||||||
local_weekday = cal.formatweekday(1)
|
local_weekday = cal.formatweekday(1)
|
||||||
local_month = cal.formatmonthname(2010, 10)
|
local_month = cal.formatmonthname(2010, 10)
|
||||||
self.assertIsInstance(local_weekday, str)
|
self.assertIsInstance(local_weekday, str)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue