(self)
| 98 | out.rstrip()) |
| 99 | |
| 100 | def test_filesystemencoding(self): |
| 101 | code = textwrap.dedent(''' |
| 102 | import sys |
| 103 | print("{}/{}".format(sys.getfilesystemencoding(), |
| 104 | sys.getfilesystemencodeerrors())) |
| 105 | ''') |
| 106 | |
| 107 | if MS_WINDOWS: |
| 108 | expected = 'utf-8/surrogatepass' |
| 109 | else: |
| 110 | expected = 'utf-8/surrogateescape' |
| 111 | |
| 112 | out = self.get_output('-X', 'utf8', '-c', code) |
| 113 | self.assertEqual(out, expected) |
| 114 | |
| 115 | if MS_WINDOWS: |
| 116 | # PYTHONLEGACYWINDOWSFSENCODING disables the UTF-8 mode |
| 117 | # and has the priority over -X utf8 and PYTHONUTF8 |
| 118 | out = self.get_output('-X', 'utf8', '-c', code, |
| 119 | PYTHONUTF8='xxx', |
| 120 | PYTHONLEGACYWINDOWSFSENCODING='1') |
| 121 | self.assertEqual(out, 'mbcs/replace') |
| 122 | |
| 123 | def test_stdio(self): |
| 124 | code = textwrap.dedent(''' |
nothing calls this directly
no test coverage detected