Skip to content

Commit

Permalink
pythongh-57539: Increase calendar test coverage (pythonGH-93468)
Browse files Browse the repository at this point in the history
Co-authored-by: Sean Fleming
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
  • Loading branch information
3 people authored Jun 7, 2022
1 parent 1b74803 commit f0d0be3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Lib/test/test_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,19 @@ def test_locale_calendars(self):
new_october = calendar.TextCalendar().formatmonthname(2010, 10, 10)
self.assertEqual(old_october, new_october)

def test_locale_calendar_formatweekday(self):
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.
self.assertEqual(cal.formatweekday(0, 2), "Mo")
# For long widths, the full day name is used.
self.assertEqual(cal.formatweekday(0, 10), " Monday ")
except locale.Error:
raise unittest.SkipTest('cannot set the en_US locale')

def test_locale_html_calendar_custom_css_class_month_name(self):
try:
cal = calendar.LocaleHTMLCalendar(locale='')
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ Nils Fischbeck
Frederik Fix
Tom Flanagan
Matt Fleming
Sean Fleming
Hernán Martínez Foffani
Benjamin Fogle
Artem Fokin
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Increase calendar test coverage for :meth:`calendar.LocaleTextCalendar.formatweekday`.

0 comments on commit f0d0be3

Please sign in to comment.