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

Method test_print

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

Source from the content-addressed store, hash-verified

3950 @unittest.expectedFailure # TODO: RUSTPYTHON; ? ^ +
3951 @requires_debug_ranges()
3952 def test_print(self):
3953 def f():
3954 x = 12
3955 try:
3956 x/0
3957 except Exception as e:
3958 return e
3959 exc = traceback.TracebackException.from_exception(f(), capture_locals=True)
3960 output = StringIO()
3961 exc.print(file=output)
3962 self.assertEqual(
3963 output.getvalue().split('\n')[-5:],
3964 [' x/0',
3965 ' ~^~',
3966 ' x = 12',
3967 'ZeroDivisionError: division by zero',
3968 ''])
3969
3970 def test_dont_swallow_cause_or_context_of_falsey_exception(self):
3971 # see gh-132308: Ensure that __cause__ or __context__ attributes of exceptions

Callers

nothing calls this directly

Calls 7

getvalueMethod · 0.95
StringIOClass · 0.90
from_exceptionMethod · 0.80
fFunction · 0.70
printMethod · 0.45
assertEqualMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected