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

Method test_stack_format

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

Source from the content-addressed store, hash-verified

1963 self.check_traceback_format(cleanup_tb)
1964
1965 def test_stack_format(self):
1966 # Verify _stack functions. Note we have to use _getframe(1) to
1967 # compare them without this frame appearing in the output
1968 with captured_output("stderr") as ststderr:
1969 traceback.print_stack(sys._getframe(1))
1970 stfile = StringIO()
1971 traceback.print_stack(sys._getframe(1), file=stfile)
1972 self.assertEqual(ststderr.getvalue(), stfile.getvalue())
1973
1974 stfmt = traceback.format_stack(sys._getframe(1))
1975
1976 self.assertEqual(ststderr.getvalue(), "".join(stfmt))
1977
1978 def test_print_stack(self):
1979 def prn():

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected