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

Method test_xoption

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

Source from the content-addressed store, hash-verified

46 self.assertEqual(out, '1')
47
48 def test_xoption(self):
49 code = 'import sys; print(sys.flags.utf8_mode)'
50
51 out = self.get_output('-X', 'utf8', '-c', code)
52 self.assertEqual(out, '1')
53
54 # undocumented but accepted syntax: -X utf8=1
55 out = self.get_output('-X', 'utf8=1', '-c', code)
56 self.assertEqual(out, '1')
57
58 out = self.get_output('-X', 'utf8=0', '-c', code)
59 self.assertEqual(out, '0')
60
61 if MS_WINDOWS:
62 # PYTHONLEGACYWINDOWSFSENCODING disables the UTF-8 Mode
63 # and has the priority over -X utf8
64 out = self.get_output('-X', 'utf8', '-c', code,
65 PYTHONLEGACYWINDOWSFSENCODING='1')
66 self.assertEqual(out, '0')
67
68 def test_env_var(self):
69 code = 'import sys; print(sys.flags.utf8_mode)'

Callers

nothing calls this directly

Calls 2

get_outputMethod · 0.95
assertEqualMethod · 0.45

Tested by

no test coverage detected