MCPcopy Index your code
hub / github.com/RustPython/RustPython / setUpModule

Function setUpModule

Lib/test/test_c_locale_coercion.py:176–203  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

174CLI_COERCION_WARNING = None
175
176def setUpModule():
177 global AVAILABLE_TARGETS
178 global CLI_COERCION_TARGET
179 global CLI_COERCION_WARNING
180
181 if AVAILABLE_TARGETS is not None:
182 # initialization already done
183 return
184 AVAILABLE_TARGETS = []
185
186 # Find the target locales available in the current system
187 for target_locale in _C_UTF8_LOCALES:
188 if _set_locale_in_subprocess(target_locale):
189 AVAILABLE_TARGETS.append(target_locale)
190
191 if AVAILABLE_TARGETS:
192 # Coercion is expected to use the first available target locale
193 CLI_COERCION_TARGET = AVAILABLE_TARGETS[0]
194 CLI_COERCION_WARNING = CLI_COERCION_WARNING_FMT.format(CLI_COERCION_TARGET)
195
196 if support.verbose:
197 print(f"AVAILABLE_TARGETS = {AVAILABLE_TARGETS!r}")
198 print(f"EXPECTED_C_LOCALE_EQUIVALENTS = {EXPECTED_C_LOCALE_EQUIVALENTS!r}")
199 print(f"EXPECTED_C_LOCALE_STREAM_ENCODING = {EXPECTED_C_LOCALE_STREAM_ENCODING!r}")
200 print(f"EXPECTED_C_LOCALE_FS_ENCODING = {EXPECTED_C_LOCALE_FS_ENCODING!r}")
201 print(f"EXPECT_COERCION_IN_DEFAULT_LOCALE = {EXPECT_COERCION_IN_DEFAULT_LOCALE!r}")
202 print(f"_C_UTF8_LOCALES = {_C_UTF8_LOCALES!r}")
203 print(f"_check_nl_langinfo_CODESET = {_check_nl_langinfo_CODESET!r}")
204
205
206class _LocaleHandlingTestCase(unittest.TestCase):

Callers

nothing calls this directly

Calls 4

printFunction · 0.50
appendMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected