pocketpy/tests/802_traceback.py
zhs628 fc991ab697
Increase coverage 2025 12 01 (#412)
* 通过引发py_call错误覆盖相关调用者的ok==false分支

* Revert "通过引发py_call错误覆盖相关调用者的ok==false分支"

This reverts commit 36dc0b5d81a02a83dfdeca2d4d6d265f5f793b4b.

* add test

* rename test files

* fix bugs

* fix bugs
2025-12-04 21:01:29 +08:00

19 lines
373 B
Python

import traceback
try:
a = {'123': 4}
b = a[6]
except KeyError:
actual = traceback.format_exc()
expected = '''Traceback (most recent call last):
File "tests/802_traceback.py", line 5
b = a[6]
KeyError: 6'''
if actual != expected:
print('--- ACTUAL RESULT -----')
print(actual)
print('--- EXPECTED RESULT ---')
print(expected)
exit(1)