pocketpy/tests/761_misc.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

52 lines
585 B
Python

a = 0
a += 2
assert a == 2
a -= 1
assert a == 1
a *= 2
assert a == 2
a //= 2
assert a == 1
a |= 0xff
assert a == 0xff
a &= 0x0f
assert a == 0x0f
a = 8
a %= 3
assert a == 2
a ^= 0xf0
assert a == 242
# incremental set
class A: pass
for i in range(ord('a'), ord('z')+1):
setattr(A, chr(i), i)
assert A.a == ord('a')
assert A.z == ord('z')
assert ord('') == 27979
try:
assert ord('测试')
print("Should not reach here")
exit(1)
except TypeError:
pass
try:
assert ord('12')
print("Should not reach here")
exit(1)
except TypeError:
pass