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

Method test_encoding_warning

Lib/test/test_subprocess.py:1975–1986  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1973 f"{stacks}```")
1974
1975 def test_encoding_warning(self):
1976 code = textwrap.dedent("""\
1977 from subprocess import *
1978 run("echo hello", shell=True, text=True)
1979 check_output("echo hello", shell=True, text=True)
1980 """)
1981 cp = subprocess.run([sys.executable, "-Xwarn_default_encoding", "-c", code],
1982 capture_output=True)
1983 lines = cp.stderr.splitlines()
1984 self.assertEqual(len(lines), 2, lines)
1985 self.assertStartsWith(lines[0], b"<string>:2: EncodingWarning: ")
1986 self.assertStartsWith(lines[1], b"<string>:3: EncodingWarning: ")
1987
1988
1989def _get_test_grp_name():

Callers

nothing calls this directly

Calls 5

assertStartsWithMethod · 0.80
dedentMethod · 0.45
runMethod · 0.45
splitlinesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected