wip: all tests pass

This commit is contained in:
Dan Halbert 2025-06-12 12:08:43 -04:00
parent 356643826a
commit 7298abea66
3 changed files with 2 additions and 35 deletions

View file

@ -1,32 +0,0 @@
# test MicroPython-specific features of struct
try:
import struct
except ImportError:
print("SKIP")
raise SystemExit
class A():
pass
# pack and unpack objects
o = A()
s = struct.pack("<O", o)
o2 = struct.unpack("<O", s)
print(o is o2[0])
# pack can accept less arguments than required for the format spec
print(struct.pack('<2I', 1))
# pack and unpack pointer to a string
# This requires uctypes to get the address of the string and instead of
# putting this in a dedicated test that can be skipped we simply pass
# if the import fails.
try:
import uctypes
o = uctypes.addressof('abc')
s = struct.pack("<S", o)
o2 = struct.unpack("<S", s)
assert o2[0] == 'abc'
except ImportError:
pass

View file

@ -1,2 +0,0 @@
True
b'\x01\x00\x00\x00\x00\x00\x00\x00'

View file

@ -3,4 +3,5 @@ import micropython as micropython
# check that level 3 doesn't store line numbers
# the expected output is that any line is printed as "line 1"
micropython.opt_level(3)
exec("try:\n xyz\nexcept NameError as er:\n import sys\n sys.print_exception(er)")
# CIRCUITPY-CHANGE: use traceback.print_exception() instead of sys.print_exception()
exec("try:\n xyz\nexcept NameError as er:\n import traceback\n traceback.print_exception(er)")