Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2b6f1f9

Browse files
committed
Expand the try clause to calls toLocaleTextCalendar.formatmonthname().
This method temporarily changes the current locale to the given locale,so `_locale.setlocale()` may raise `local.Error`.
1 parent40e0da3 commit2b6f1f9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎Lib/test/test_calendar.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -644,14 +644,14 @@ def test_locale_calendar_formatmonthname(self):
644644
try:
645645
# formatmonthname uses the same month names regardless of the width argument.
646646
cal=calendar.LocaleTextCalendar(locale='en_US')
647+
# For too short widths, a full name (with year) is used.
648+
self.assertEqual(cal.formatmonthname(2022,6,2,withyear=False),"June")
649+
self.assertEqual(cal.formatmonthname(2022,6,2,withyear=True),"June 2022")
650+
# For long widths, a centered name is used.
651+
self.assertEqual(cal.formatmonthname(2022,6,10,withyear=False)," June ")
652+
self.assertEqual(cal.formatmonthname(2022,6,15,withyear=True)," June 2022 ")
647653
exceptlocale.Error:
648654
raiseunittest.SkipTest('cannot set the en_US locale')
649-
# For too short widths, a full name (with year) is used.
650-
self.assertEqual(cal.formatmonthname(2022,6,2,withyear=False),"June")
651-
self.assertEqual(cal.formatmonthname(2022,6,2,withyear=True),"June 2022")
652-
# For long widths, a centered name is used.
653-
self.assertEqual(cal.formatmonthname(2022,6,10,withyear=False)," June ")
654-
self.assertEqual(cal.formatmonthname(2022,6,15,withyear=True)," June 2022 ")
655655

656656
deftest_locale_html_calendar_custom_css_class_month_name(self):
657657
try:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp