1
0

80_traceback.py 372 B

12345678910111213141516171819
  1. import traceback
  2. try:
  3. a = {'123': 4}
  4. b = a[6]
  5. except KeyError:
  6. actual = traceback.format_exc()
  7. expected = '''Traceback (most recent call last):
  8. File "tests/80_traceback.py", line 5
  9. b = a[6]
  10. KeyError: 6'''
  11. if actual != expected:
  12. print('--- ACTUAL RESULT -----')
  13. print(actual)
  14. print('--- EXPECTED RESULT ---')
  15. print(expected)
  16. exit(1)