mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
gh-101377: improving test_locale_calendar_formatweekday of calendar (#101378)
--------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
parent
e94edab727
commit
5e0865f22e
2 changed files with 8 additions and 3 deletions
|
|
@ -568,11 +568,15 @@ class CalendarTestCase(unittest.TestCase):
|
||||||
try:
|
try:
|
||||||
# formatweekday uses different day names based on the available width.
|
# formatweekday uses different day names based on the available width.
|
||||||
cal = calendar.LocaleTextCalendar(locale='en_US')
|
cal = calendar.LocaleTextCalendar(locale='en_US')
|
||||||
# For short widths, a centered, abbreviated name is used.
|
# For really short widths, the abbreviated name is truncated.
|
||||||
self.assertEqual(cal.formatweekday(0, 5), " Mon ")
|
self.assertEqual(cal.formatweekday(0, 1), "M")
|
||||||
# For really short widths, even the abbreviated name is truncated.
|
|
||||||
self.assertEqual(cal.formatweekday(0, 2), "Mo")
|
self.assertEqual(cal.formatweekday(0, 2), "Mo")
|
||||||
|
# For short widths, a centered, abbreviated name is used.
|
||||||
|
self.assertEqual(cal.formatweekday(0, 3), "Mon")
|
||||||
|
self.assertEqual(cal.formatweekday(0, 5), " Mon ")
|
||||||
|
self.assertEqual(cal.formatweekday(0, 8), " Mon ")
|
||||||
# For long widths, the full day name is used.
|
# For long widths, the full day name is used.
|
||||||
|
self.assertEqual(cal.formatweekday(0, 9), " Monday ")
|
||||||
self.assertEqual(cal.formatweekday(0, 10), " Monday ")
|
self.assertEqual(cal.formatweekday(0, 10), " Monday ")
|
||||||
except locale.Error:
|
except locale.Error:
|
||||||
raise unittest.SkipTest('cannot set the en_US locale')
|
raise unittest.SkipTest('cannot set the en_US locale')
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Improved test_locale_calendar_formatweekday of calendar.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue