summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/struct_micropython.py
blob: e3b0ea5086ed5385a46c6cd32631212f3e3eaaf2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# test MicroPython-specific features of struct

try:
    import ustruct as struct
except:
    try:
        import struct
    except ImportError:
        import sys
        print("SKIP")
        sys.exit()

class A():
    pass

# pack and unpack objects
o = A()
s = struct.pack("<O", o)
o2 = struct.unpack("<O", s)
print(o is o2[0])