(self)
| 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)' |
nothing calls this directly
no test coverage detected