Skip to content

Commit 6f4df72

Browse files
miss-islingtonandrehorablurb-it[bot]terryjreedy
authored
gh-101377: improving test_locale_calendar_formatweekday of calendar (GH-101378)
--------- (cherry picked from commit 5e0865f) Co-authored-by: Andre Hora <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Terry Jan Reedy <[email protected]>
1 parent 95fd2df commit 6f4df72

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Lib/test/test_calendar.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,11 +568,15 @@ def test_locale_calendar_formatweekday(self):
568568
try:
569569
# formatweekday uses different day names based on the available width.
570570
cal = calendar.LocaleTextCalendar(locale='en_US')
571+
# For really short widths, the abbreviated name is truncated.
572+
self.assertEqual(cal.formatweekday(0, 1), "M")
573+
self.assertEqual(cal.formatweekday(0, 2), "Mo")
571574
# For short widths, a centered, abbreviated name is used.
575+
self.assertEqual(cal.formatweekday(0, 3), "Mon")
572576
self.assertEqual(cal.formatweekday(0, 5), " Mon ")
573-
# For really short widths, even the abbreviated name is truncated.
574-
self.assertEqual(cal.formatweekday(0, 2), "Mo")
577+
self.assertEqual(cal.formatweekday(0, 8), " Mon ")
575578
# For long widths, the full day name is used.
579+
self.assertEqual(cal.formatweekday(0, 9), " Monday ")
576580
self.assertEqual(cal.formatweekday(0, 10), " Monday ")
577581
except locale.Error:
578582
raise unittest.SkipTest('cannot set the en_US locale')
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improved test_locale_calendar_formatweekday of calendar.

0 commit comments

Comments
 (0)