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

Method test_optim_level

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

Source from the content-addressed store, hash-verified

237 check('utf8=0', [c_arg], LC_ALL=loc)
238
239 def test_optim_level(self):
240 # CPython: check that Py_Main() doesn't increment Py_OptimizeFlag
241 # twice when -X utf8 requires to parse the configuration twice (when
242 # the encoding changes after reading the configuration, the
243 # configuration is read again with the new encoding).
244 code = 'import sys; print(sys.flags.optimize)'
245 out = self.get_output('-X', 'utf8', '-O', '-c', code)
246 self.assertEqual(out, '1')
247 out = self.get_output('-X', 'utf8', '-OO', '-c', code)
248 self.assertEqual(out, '2')
249
250 code = 'import sys; print(sys.flags.ignore_environment)'
251 out = self.get_output('-X', 'utf8', '-E', '-c', code)
252 self.assertEqual(out, '1')
253
254 @unittest.skipIf(MS_WINDOWS,
255 "os.device_encoding() doesn't implement "

Callers

nothing calls this directly

Calls 2

get_outputMethod · 0.95
assertEqualMethod · 0.45

Tested by

no test coverage detected