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

Method test_coding

Lib/test/test_cmd_line.py:250–255  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

248
249 @unittest.skipUnless(os_helper.FS_NONASCII, 'need os_helper.FS_NONASCII')
250 def test_coding(self):
251 # bpo-32381: the -c command ignores the coding cookie
252 ch = os_helper.FS_NONASCII
253 cmd = f"# coding: latin1\nprint(ascii('{ch}'))"
254 res = assert_python_ok('-c', cmd)
255 self.assertEqual(res.out.rstrip(), ascii(ch).encode('ascii'))
256
257 # On Windows, pass bytes to subprocess doesn't test how Python decodes the
258 # command line, but how subprocess does decode bytes to unicode. Python

Callers

nothing calls this directly

Calls 5

assert_python_okFunction · 0.90
asciiFunction · 0.85
assertEqualMethod · 0.45
rstripMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected