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

Method test_truncate

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

get_outputMethod · 0.95
formatMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected