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

Method test_truncate

Lib/test/test_faulthandler.py:544–566  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

542 self.check_dump_traceback(fd=fp.fileno())
543
544 def test_truncate(self):
545 maxlen = 500
546 func_name = 'x' * (maxlen + 50)
547 truncated = 'x' * maxlen + '...'
548 code = """
549 import faulthandler
550
551 def {func_name}():
552 faulthandler.dump_traceback(all_threads=False)
553
554 {func_name}()
555 """
556 code = code.format(
557 func_name=func_name,
558 )
559 expected = [
560 f'{STACK_HEADER_STR}',
561 ' File "<string>", line 4 in %s' % truncated,
562 ' File "<string>", line 6 in <module>'
563 ]
564 trace, exitcode = self.get_output(code)
565 self.assertEqual(trace, expected)
566 self.assertEqual(exitcode, 0)
567
568 def check_dump_traceback_threads(self, filename):
569 """

Callers

nothing calls this directly

Calls 3

get_outputMethod · 0.95
formatMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected