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

Method test_filename_in_syntaxerror

Lib/test/test_fstring.py:1516–1524  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1514 ])
1515
1516 def test_filename_in_syntaxerror(self):
1517 # see issue 38964
1518 with temp_cwd() as cwd:
1519 file_path = os.path.join(cwd, 't.py')
1520 with open(file_path, 'w', encoding="utf-8") as f:
1521 f.write('f"{a b}"') # This generates a SyntaxError
1522 _, _, stderr = assert_python_failure(file_path,
1523 PYTHONIOENCODING='ascii')
1524 self.assertIn(file_path.encode('ascii', 'backslashreplace'), stderr)
1525
1526 def test_loop(self):
1527 for i in range(1000):

Callers

nothing calls this directly

Calls 7

assertInMethod · 0.95
temp_cwdFunction · 0.90
assert_python_failureFunction · 0.90
openFunction · 0.50
joinMethod · 0.45
writeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected