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

Method test_non_ascii

Lib/test/test_cmd_line_script.py:570–592  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

568
569 @unittest.expectedFailureIf(sys.platform == "linux", "TODO: RUSTPYTHON")
570 def test_non_ascii(self):
571 # Mac OS X denies the creation of a file with an invalid UTF-8 name.
572 # Windows allows creating a name with an arbitrary bytes name, but
573 # Python cannot a undecodable bytes argument to a subprocess.
574 # WASI does not permit invalid UTF-8 names.
575 if (os_helper.TESTFN_UNDECODABLE
576 and sys.platform not in ('win32', 'darwin', 'emscripten', 'wasi')):
577 name = os.fsdecode(os_helper.TESTFN_UNDECODABLE)
578 elif os_helper.TESTFN_NONASCII:
579 name = os_helper.TESTFN_NONASCII
580 else:
581 self.skipTest("need os_helper.TESTFN_NONASCII")
582
583 # Issue #16218
584 source = 'print(ascii(__file__))\n'
585 script_name = _make_test_script(os.getcwd(), name, source)
586 self.addCleanup(os_helper.unlink, script_name)
587 rc, stdout, stderr = assert_python_ok(script_name)
588 self.assertEqual(
589 ascii(script_name),
590 stdout.rstrip().decode('ascii'),
591 'stdout=%r stderr=%r' % (stdout, stderr))
592 self.assertEqual(0, rc)
593
594 def test_issue20500_exit_with_exception_value(self):
595 script = textwrap.dedent("""\

Callers

nothing calls this directly

Calls 9

assert_python_okFunction · 0.90
asciiFunction · 0.85
fsdecodeMethod · 0.80
skipTestMethod · 0.80
addCleanupMethod · 0.80
_make_test_scriptFunction · 0.70
assertEqualMethod · 0.45
decodeMethod · 0.45
rstripMethod · 0.45

Tested by

no test coverage detected