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

Method test_filesystemencoding

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

Source from the content-addressed store, hash-verified

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('''

Callers

nothing calls this directly

Calls 3

get_outputMethod · 0.95
dedentMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected