Skip to content

Commit 60431a9

Browse files
committed
gh-137481: fix test expectations on some platforms
1 parent 73fb155 commit 60431a9

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Lib/test/test_calendar.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -735,12 +735,15 @@ def get_weekday_names(width):
735735
def test_locale_calendar_long_weekday_names(self):
736736
names = (datetime.date(2001, 1, i+1).strftime('%A') for i in range(7))
737737
max_length = max(map(len, names))
738-
if max_length <= 9:
739-
self.skipTest('weekday names are too short')
738+
abbrev_names = (datetime.date(2001, 1, i+1).strftime('%a') for i in range(7))
739+
abbrev_max_length = max(map(len, abbrev_names))
740+
741+
if max_length - abbrev_max_length < 3:
742+
self.skipTest('standard and abbreviated weekday names have too similar lengths')
740743

741744
def get_weekday_names(width):
742745
return calendar.TextCalendar().formatweekheader(width).split()
743-
self.assertEqual(get_weekday_names(4), get_weekday_names(9))
746+
self.assertEqual(get_weekday_names(abbrev_max_length+1), get_weekday_names(max_length-1))
744747

745748
def test_locale_calendar_formatmonthname(self):
746749
try:

0 commit comments

Comments
 (0)