MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_osx_android_utf8

Method test_osx_android_utf8

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

Source from the content-addressed store, hash-verified

311 @unittest.skipUnless((sys.platform == 'darwin' or
312 support.is_android), 'test specific to Mac OS X and Android')
313 def test_osx_android_utf8(self):
314 text = 'e:\xe9, euro:\u20ac, non-bmp:\U0010ffff'.encode('utf-8')
315 code = "import sys; print(ascii(sys.argv[1]))"
316
317 decoded = text.decode('utf-8', 'surrogateescape')
318 expected = ascii(decoded).encode('ascii') + b'\n'
319
320 env = os.environ.copy()
321 # C locale gives ASCII locale encoding, but Python uses UTF-8
322 # to parse the command line arguments on Mac OS X and Android.
323 env['LC_ALL'] = 'C'
324
325 p = subprocess.Popen(
326 (sys.executable, "-c", code, text),
327 stdout=subprocess.PIPE,
328 env=env)
329 stdout, stderr = p.communicate()
330 self.assertEqual(stdout, expected)
331 self.assertEqual(p.returncode, 0)
332
333 def test_non_interactive_output_buffering(self):
334 code = textwrap.dedent("""

Callers

nothing calls this directly

Calls 6

communicateMethod · 0.95
asciiFunction · 0.85
encodeMethod · 0.45
decodeMethod · 0.45
copyMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected