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

Method test_optim_level

Lib/test/test_utf8_mode.py:247–260  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

245 check('utf8=0', [c_arg], LC_ALL=loc)
246
247 def test_optim_level(self):
248 # CPython: check that Py_Main() doesn't increment Py_OptimizeFlag
249 # twice when -X utf8 requires to parse the configuration twice (when
250 # the encoding changes after reading the configuration, the
251 # configuration is read again with the new encoding).
252 code = 'import sys; print(sys.flags.optimize)'
253 out = self.get_output('-X', 'utf8', '-O', '-c', code)
254 self.assertEqual(out, '1')
255 out = self.get_output('-X', 'utf8', '-OO', '-c', code)
256 self.assertEqual(out, '2')
257
258 code = 'import sys; print(sys.flags.ignore_environment)'
259 out = self.get_output('-X', 'utf8', '-E', '-c', code)
260 self.assertEqual(out, '1')
261
262 # TODO: RUSTPYTHON
263 @unittest.expectedFailure

Callers

nothing calls this directly

Calls 2

get_outputMethod · 0.95
assertEqualMethod · 0.45

Tested by

no test coverage detected