Skip to content

Commit 9450cc0

Browse files
committed
Fix r85728: use "" to mean the system default locale, which should work on more systems.
1 parent f19076e commit 9450cc0

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

Lib/test/test_calendar.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,16 +254,13 @@ def test_months(self):
254254
def test_localecalendars(self):
255255
# ensure that Locale{Text,HTML}Calendar resets the locale properly
256256
# (it is still not thread-safe though)
257+
old_october = calendar.TextCalendar().formatmonthname(2010, 10, 10)
257258
try:
258-
def_locale = locale.getdefaultlocale()
259+
calendar.LocaleTextCalendar(locale='').formatmonthname(2010, 10, 10)
259260
except locale.Error:
260-
# cannot determine a default locale -- skip test
261+
# cannot set the system default locale -- skip rest of test
261262
return
262-
old_october = calendar.TextCalendar().formatmonthname(2010, 10, 10)
263-
calendar.LocaleTextCalendar(
264-
locale=def_locale).formatmonthname(2010, 10, 10)
265-
calendar.LocaleHTMLCalendar(
266-
locale=def_locale).formatmonthname(2010, 10)
263+
calendar.LocaleHTMLCalendar(locale='').formatmonthname(2010, 10)
267264
new_october = calendar.TextCalendar().formatmonthname(2010, 10, 10)
268265
self.assertEquals(old_october, new_october)
269266

0 commit comments

Comments
 (0)