Skip to content

Commit 95cabcd

Browse files
committed
test for proper abbreviation of long names
1 parent c796689 commit 95cabcd

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Lib/test/test_calendar.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,18 @@ def test_locale_calendar_weekday_names(self):
715715
# Any width shorter than the longest necessary should produce abbreviations
716716
self.assertNotEqual(get_weekday_names(max_length), get_weekday_names(max_length - 1))
717717

718+
# These locales have a weekday name longer than English's longest 'Wednesday'
719+
# They should be properly abbreviated rather than truncated
720+
@support.run_with_locale("LC_ALL",
721+
'Portuguese', 'pt_PT.UTF-8',
722+
'German', 'de_DE.UTF-8',
723+
'Russian', 'ru_RU.UTF-8',
724+
'Sinhala', 'si_LK.UTF-8'
725+
)
726+
def test_locale_calendar_long_weekday_names(self):
727+
get_weekday_names = lambda width: calendar.TextCalendar().formatweekheader(width).split()
728+
self.assertEqual(get_weekday_names(4), get_weekday_names(9))
729+
718730
def test_locale_calendar_formatmonthname(self):
719731
try:
720732
# formatmonthname uses the same month names regardless of the width argument.

0 commit comments

Comments
 (0)