diff options
author | Rami Ali <flowergrass@users.noreply.github.com> | 2016-12-28 15:29:21 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-12-28 16:11:54 +1100 |
commit | 65574f817a949fea2316c335da866c1b8d20f1fb (patch) | |
tree | 382e7a3cbfb788f1e60aff9c26776bfaa1e3790c /tests/basics/struct_micropython.py | |
parent | ea6a958393eff6999040dd3852d505ae78b96f5b (diff) | |
download | micropython-65574f817a949fea2316c335da866c1b8d20f1fb.tar.gz micropython-65574f817a949fea2316c335da866c1b8d20f1fb.zip |
tests/basics: Add tests to improve coverage of binary.c.
Diffstat (limited to 'tests/basics/struct_micropython.py')
-rw-r--r-- | tests/basics/struct_micropython.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/basics/struct_micropython.py b/tests/basics/struct_micropython.py new file mode 100644 index 0000000000..e3b0ea5086 --- /dev/null +++ b/tests/basics/struct_micropython.py @@ -0,0 +1,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]) |