Skip to content

Commit c70a408

Browse files
committed
pythongh-57539: Increase calendar coverage
Co-authored-by: Sean Fleming
1 parent debf4c1 commit c70a408

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

Lib/test/test_calendar.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,16 @@ def test_locale_calendars(self):
564564
new_october = calendar.TextCalendar().formatmonthname(2010, 10, 10)
565565
self.assertEqual(old_october, new_october)
566566

567+
def test_locale_calendar_formatweekday(self):
568+
# formatweekday uses different day names based on the available width.
569+
cal = calendar.LocaleTextCalendar(locale='en_US')
570+
# For short widths, a centered, abbreviated name is used.
571+
self.assertEqual(cal.formatweekday(0, 5), " Mon ")
572+
# For really short widths, even the abbreviated name is truncated.
573+
self.assertEqual(cal.formatweekday(0, 2), "Mo")
574+
# For long widths, the full day name is used.
575+
self.assertEqual(cal.formatweekday(0, 10), " Monday ")
576+
567577
def test_locale_html_calendar_custom_css_class_month_name(self):
568578
try:
569579
cal = calendar.LocaleHTMLCalendar(locale='')

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ Nils Fischbeck
548548
Frederik Fix
549549
Tom Flanagan
550550
Matt Fleming
551+
Sean Fleming
551552
Hernán Martínez Foffani
552553
Benjamin Fogle
553554
Artem Fokin
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Increase calendar coverage

0 commit comments

Comments
 (0)