@@ -696,34 +696,43 @@ def test_locale_calendar_formatweekday(self):
696696 except locale .Error :
697697 raise unittest .SkipTest ('cannot set the en_US locale' )
698698
699- # These locales have weekday names all shorter than English's longest 'Wednesday'
700- # They should not be abbreviated unnecessarily
699+ # These locales have weekday names all shorter than English's longest
700+ # 'Wednesday'. They should not be abbreviated unnecessarily
701701 @support .run_with_locale ("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 )
707707 def test_locale_calendar_weekday_names (self ):
708- max_length = max (map (len , (datetime .date (2001 , 1 , i + 1 ).strftime ('%A' ) for i in range (7 ))))
708+ names = (datetime .date (2001 , 1 , i + 1 ).strftime ('%A' ) for i in range (7 ))
709+ max_length = max (map (len , names ))
709710
710- get_weekday_names = lambda width : calendar .TextCalendar ().formatweekheader (width ).split ()
711+ def get_weekday_names (width ):
712+ return calendar .TextCalendar ().formatweekheader (width ).split ()
711713
712- # Full weekday name, not an abbreviation, should be used if the width is sufficient
713- self .assertEqual (get_weekday_names (max_length ), get_weekday_names (max_length + 10 ))
714+ # Weekday names should not be abbreviated if the width is sufficient
715+ self .assertEqual (
716+ get_weekday_names (max_length ),
717+ get_weekday_names (max_length + 10 )
718+ )
714719
715- # Any width shorter than the longest necessary should produce abbreviations
716- self .assertNotEqual (get_weekday_names (max_length ), get_weekday_names (max_length - 1 ))
720+ # Any width shorter than necessary should produce abbreviations
721+ self .assertNotEqual (
722+ get_weekday_names (max_length ),
723+ get_weekday_names (max_length - 1 )
724+ )
717725
718- # These locales have a weekday name longer than English's longest 'Wednesday'
726+ # These locales have a weekday name longer than 'Wednesday'
719727 # They should be properly abbreviated rather than truncated
720728 @support .run_with_locale ("LC_ALL" ,
721729 'Portuguese' , 'pt_PT.UTF-8' ,
722730 'German' , 'de_DE.UTF-8' ,
723731 'Russian' , 'ru_RU.UTF-8' ,
724732 )
725733 def test_locale_calendar_long_weekday_names (self ):
726- get_weekday_names = lambda width : calendar .TextCalendar ().formatweekheader (width ).split ()
734+ def get_weekday_names (width ):
735+ return calendar .TextCalendar ().formatweekheader (width ).split ()
727736 self .assertEqual (get_weekday_names (4 ), get_weekday_names (9 ))
728737
729738 def test_locale_calendar_formatmonthname (self ):
0 commit comments