(self)
| 70 | # TODO: RUSTPYTHON |
| 71 | @unittest.expectedFailure |
| 72 | def test_env_var(self): |
| 73 | code = 'import sys; print(sys.flags.utf8_mode)' |
| 74 | |
| 75 | out = self.get_output('-c', code, PYTHONUTF8='1') |
| 76 | self.assertEqual(out, '1') |
| 77 | |
| 78 | out = self.get_output('-c', code, PYTHONUTF8='0') |
| 79 | self.assertEqual(out, '0') |
| 80 | |
| 81 | # -X utf8 has the priority over PYTHONUTF8 |
| 82 | out = self.get_output('-X', 'utf8=0', '-c', code, PYTHONUTF8='1') |
| 83 | self.assertEqual(out, '0') |
| 84 | |
| 85 | if MS_WINDOWS: |
| 86 | # PYTHONLEGACYWINDOWSFSENCODING disables the UTF-8 mode |
| 87 | # and has the priority over PYTHONUTF8 |
| 88 | out = self.get_output('-X', 'utf8', '-c', code, PYTHONUTF8='1', |
| 89 | PYTHONLEGACYWINDOWSFSENCODING='1') |
| 90 | self.assertEqual(out, '0') |
| 91 | |
| 92 | # Cannot test with the POSIX locale, since the POSIX locale enables |
| 93 | # the UTF-8 mode |
| 94 | if not self.posix_locale(): |
| 95 | # PYTHONUTF8 should be ignored if -E is used |
| 96 | out = self.get_output('-E', '-c', code, PYTHONUTF8='1') |
| 97 | self.assertEqual(out, '0') |
| 98 | |
| 99 | # invalid mode |
| 100 | out = self.get_output('-c', code, PYTHONUTF8='xxx', failure=True) |
| 101 | self.assertIn('invalid PYTHONUTF8 environment variable value', |
| 102 | out.rstrip()) |
| 103 | |
| 104 | @unittest.expectedFailureIf(MS_WINDOWS, "TODO: RUSTPYTHON") |
| 105 | def test_filesystemencoding(self): |
nothing calls this directly
no test coverage detected