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

Method test_stack_format

Lib/test/test_traceback.py:2038–2049  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2036 self.check_traceback_format(cleanup_tb)
2037
2038 def test_stack_format(self):
2039 # Verify _stack functions. Note we have to use _getframe(1) to
2040 # compare them without this frame appearing in the output
2041 with captured_output("stderr") as ststderr:
2042 traceback.print_stack(sys._getframe(1))
2043 stfile = StringIO()
2044 traceback.print_stack(sys._getframe(1), file=stfile)
2045 self.assertEqual(ststderr.getvalue(), stfile.getvalue())
2046
2047 stfmt = traceback.format_stack(sys._getframe(1))
2048
2049 self.assertEqual(ststderr.getvalue(), "".join(stfmt))
2050
2051 def test_print_stack(self):
2052 def prn():

Callers

nothing calls this directly

Calls 7

getvalueMethod · 0.95
captured_outputFunction · 0.90
StringIOClass · 0.90
print_stackMethod · 0.45
assertEqualMethod · 0.45
getvalueMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected