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

Method test_error

Lib/test/test_compileall.py:516–527  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

514 shutil.rmtree(self.directory)
515
516 def test_error(self):
517 buffer = io.TextIOWrapper(io.BytesIO(), encoding='ascii')
518 with contextlib.redirect_stdout(buffer):
519 compiled = compileall.compile_dir(self.directory)
520 self.assertFalse(compiled) # should not be successful
521 buffer.seek(0)
522 res = buffer.read()
523 self.assertIn(
524 'SyntaxError: bytes can only contain ASCII literal characters',
525 res,
526 )
527 self.assertNotIn('UnicodeEncodeError', res)
528
529
530class CommandLineTestsBase:

Callers

nothing calls this directly

Calls 6

seekMethod · 0.95
readMethod · 0.95
compile_dirMethod · 0.80
assertFalseMethod · 0.80
assertInMethod · 0.80
assertNotInMethod · 0.80

Tested by

no test coverage detected