Debian Codegraph @

tests/runtime/test_arithmetic_error.py

raw symbols SCIP
1 import friendly_traceback
2
3
4 def test_Generic():
5 try:
6 # I am not aware of any way in which this error is raised directly
7 # Usually, a subclass such as ZeroDivisionError, etc., would
8 # likely be raised.
9 raise ArithmeticError('error')
10 except ArithmeticError as e:
11 message = str(e)
12 friendly_traceback.explain_traceback(redirect="capture")
13 result = friendly_traceback.get_output()
14
15 assert "ArithmeticError" in result
16 if friendly_traceback.get_lang() == "en":
17 assert "`ArithmeticError` is the base class" in result
18 if friendly_traceback._writing_docs:
19 return result, message
20
21
22 if __name__ == "__main__":
23 print(test_Generic()[0])