Skip to content

Commit

Permalink
gh-101377: improving test_locale_calendar_formatweekday of calendar (#…
Browse files Browse the repository at this point in the history
…101378)


---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
  • Loading branch information
3 people authored Mar 15, 2023
1 parent e94edab commit 5e0865f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Lib/test/test_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,11 +568,15 @@ def test_locale_calendar_formatweekday(self):
try:
# formatweekday uses different day names based on the available width.
cal = calendar.LocaleTextCalendar(locale='en_US')
# 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 ")
# For really short widths, even the abbreviated name is truncated.
self.assertEqual(cal.formatweekday(0, 2), "Mo")
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')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improved test_locale_calendar_formatweekday of calendar.

0 comments on commit 5e0865f

Please sign in to comment.