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:
Andre Hora 2023-03-14 23:36:31 -03:00 committed by GitHub
parent e94edab727
commit 5e0865f22e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -568,11 +568,15 @@ class CalendarTestCase(unittest.TestCase):
try:
# formatweekday uses different day names based on the available width.
cal = calendar.LocaleTextCalendar(locale='en_US')
# For short widths, a centered, abbreviated name is used.
self.assertEqual(cal.formatweekday(0, 5), " Mon ")
# For really short widths, even the abbreviated name is truncated.
# For really short widths, the abbreviated name is truncated.
self.assertEqual(cal.formatweekday(0, 1), "M")
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.
self.assertEqual(cal.formatweekday(0, 9), " Monday ")
self.assertEqual(cal.formatweekday(0, 10), " Monday ")
except locale.Error:
raise unittest.SkipTest('cannot set the en_US locale')

View File

@ -0,0 +1 @@
Improved test_locale_calendar_formatweekday of calendar.