https://github.com/python/cpython/commit/f60f8225ed146a8f9b5fbf1eeed3474782127ea8
commit: f60f8225ed146a8f9b5fbf1eeed3474782127ea8
branch: main
author: Jakub KulĂ­k <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2025-08-26T14:21:09+03:00
summary:

gh-137481: Fix test_calendar on Solaris and OpenIndiana (GH-138156)

In some locales (e.g. pt_PT.UTF-8), the abbreviated weekday names
are longer than three character.

files:
M Lib/test/test_calendar.py

diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py
index 410063e01582f9..c129b3e51ba13d 100644
--- a/Lib/test/test_calendar.py
+++ b/Lib/test/test_calendar.py
@@ -735,12 +735,17 @@ def get_weekday_names(width):
     def test_locale_calendar_long_weekday_names(self):
         names = (datetime.date(2001, 1, i+1).strftime('%A') for i in range(7))
         max_length = max(map(len, names))
+        abbrev_names = (datetime.date(2001, 1, i+1).strftime('%a') for i in 
range(7))
+        abbrev_max_length = max(map(len, abbrev_names))
+
         if max_length <= 9:
             self.skipTest('weekday names are too short')
+        if abbrev_max_length >= 9:
+            self.skipTest('abbreviated weekday names are too long')
 
         def get_weekday_names(width):
             return calendar.TextCalendar().formatweekheader(width).split()
-        self.assertEqual(get_weekday_names(4), get_weekday_names(9))
+        self.assertEqual(get_weekday_names(abbrev_max_length), 
get_weekday_names(max_length-1))
 
     def test_locale_calendar_formatmonthname(self):
         try:

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to