MCPcopy Index your code
hub / github.com/python/cpython / test_option_locale

Method test_option_locale

Lib/test/test_calendar.py:1166–1187  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1164 self.assertEqual(output, result_2004_text.encode('utf-16-le'))
1165
1166 def test_option_locale(self):
1167 self.assertFailure('-L')
1168 self.assertFailure('--locale')
1169 self.assertFailure('-L', 'en')
1170
1171 lang, enc = locale.getlocale()
1172 lang = lang or 'C'
1173 enc = enc or 'UTF-8'
1174 try:
1175 oldlocale = locale.getlocale(locale.LC_TIME)
1176 try:
1177 locale.setlocale(locale.LC_TIME, (lang, enc))
1178 finally:
1179 locale.setlocale(locale.LC_TIME, oldlocale)
1180 except (locale.Error, ValueError):
1181 self.skipTest('cannot set the system default locale')
1182 for run in self.runners:
1183 for type in ('text', 'html'):
1184 output = run(
1185 '--type', type, '--locale', lang, '--encoding', enc, '2004'
1186 )
1187 self.assertIn('2004'.encode(enc), output)
1188
1189 def test_option_width(self):
1190 self.assertFailure('-w')

Callers

nothing calls this directly

Calls 5

assertFailureMethod · 0.95
skipTestMethod · 0.80
assertInMethod · 0.80
runFunction · 0.70
encodeMethod · 0.45

Tested by

no test coverage detected