Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Skip test if locale not available
  • Loading branch information
hugovk committed Jun 3, 2022
commit 5288325920be1d37a617961dc61e4ae2b80818ca
20 changes: 12 additions & 8 deletions Lib/test/test_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,14 +565,18 @@ def test_locale_calendars(self):
self.assertEqual(old_october, new_october)

def test_locale_calendar_formatweekday(self):
# 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 ")
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:
# cannot set the en_US locale -- skip test
raise unittest.SkipTest('cannot set the en_US locale')
Comment thread
ambv marked this conversation as resolved.
Outdated

def test_locale_html_calendar_custom_css_class_month_name(self):
try:
Expand Down