Skip to content

Commit fab014e

Browse files
authored
added test
1 parent 675377b commit fab014e

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Lib/test/test_calendar.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,26 @@ def test_locale_calendar_formatweekday(self):
695695
self.assertEqual(cal.formatweekday(0, 10), " Monday ")
696696
except locale.Error:
697697
raise unittest.SkipTest('cannot set the en_US locale')
698+
699+
def test_locale_calendar_shorter_day_names(self):
700+
locale_tested = False
701+
for locale_name in [
702+
'french', 'fr_FR.UTF-8',
703+
'malay', 'ms_MY.UTF-8',
704+
'norwegian', 'nb_NO.UTF-8',
705+
'danish', 'da_DK.UTF-8'
706+
]:
707+
try:
708+
cal = calendar.LocaleTextCalendar(locale=locale_name)
709+
week_header_split = lambda width: cal.formatweekheader(width).split()
710+
self.assertEqual(week_header_split(8), week_header_split(9))
711+
locale_tested = True
712+
break
713+
except locale.Error:
714+
continue
715+
716+
if not locale_tested:
717+
raise unittest.SkipTest('cannot set the locale to a language with short weekday names')
698718

699719
def test_locale_calendar_formatmonthname(self):
700720
try:

0 commit comments

Comments
 (0)