@@ -695,18 +695,20 @@ 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-
698+
699699 # These locales have weekday names all shorter than English's longest
700700 # 'Wednesday'. They should not be abbreviated unnecessarily
701- @support .run_with_locale ("LC_ALL" ,
701+ @support .run_with_locales ("LC_ALL" ,
702702 'Chinese' , 'zh_CN.UTF-8' ,
703703 'French' , 'fr_FR.UTF-8' ,
704704 'Norwegian' , 'nb_NO.UTF-8' ,
705705 'Malay' , 'ms_MY.UTF8'
706706 )
707- def test_locale_calendar_weekday_names (self ):
707+ def test_locale_calendar_short_weekday_names (self ):
708708 names = (datetime .date (2001 , 1 , i + 1 ).strftime ('%A' ) for i in range (7 ))
709709 max_length = max (map (len , names ))
710+ if max_length >= 9 :
711+ self .skipTest ('weekday names are too long' )
710712
711713 def get_weekday_names (width ):
712714 return calendar .TextCalendar ().formatweekheader (width ).split ()
@@ -725,12 +727,17 @@ def get_weekday_names(width):
725727
726728 # These locales have a weekday name longer than 'Wednesday'
727729 # They should be properly abbreviated rather than truncated
728- @support .run_with_locale ("LC_ALL" ,
730+ @support .run_with_locales ("LC_ALL" ,
729731 'Portuguese' , 'pt_PT.UTF-8' ,
730732 'German' , 'de_DE.UTF-8' ,
731733 'Russian' , 'ru_RU.UTF-8' ,
732734 )
733735 def test_locale_calendar_long_weekday_names (self ):
736+ names = (datetime .date (2001 , 1 , i + 1 ).strftime ('%A' ) for i in range (7 ))
737+ max_length = max (map (len , names ))
738+ if max_length <= 9 :
739+ self .skipTest ('weekday names are too short' )
740+
734741 def get_weekday_names (width ):
735742 return calendar .TextCalendar ().formatweekheader (width ).split ()
736743 self .assertEqual (get_weekday_names (4 ), get_weekday_names (9 ))
0 commit comments