diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-12-09 22:53:30 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-12-09 22:53:30 +0300 |
commit | aee13ef3f219a7a2e19c017323694b946d500d14 (patch) | |
tree | bf564eb3524c22944a44a531e8c81fd434034f8b | |
parent | 9d787de2a17f99cfeb715507857b92d54b023715 (diff) | |
download | micropython-aee13ef3f219a7a2e19c017323694b946d500d14.tar.gz micropython-aee13ef3f219a7a2e19c017323694b946d500d14.zip |
tests: Update for required byteorder arg for int.from_bytes()/to_bytes().
-rw-r--r-- | tests/basics/int_bytes_notimpl.py | 9 | ||||
-rw-r--r-- | tests/basics/int_bytes_notimpl.py.exp | 2 | ||||
-rw-r--r-- | tests/extmod/uctypes_ptr_le.py | 2 | ||||
-rw-r--r-- | tests/extmod/uctypes_ptr_native_le.py | 2 |
4 files changed, 13 insertions, 2 deletions
diff --git a/tests/basics/int_bytes_notimpl.py b/tests/basics/int_bytes_notimpl.py new file mode 100644 index 0000000000..b47d6ab584 --- /dev/null +++ b/tests/basics/int_bytes_notimpl.py @@ -0,0 +1,9 @@ +try: + print((10).to_bytes(1, "big")) +except Exception as e: + print(type(e)) + +try: + print(int.from_bytes(b"\0", "big")) +except Exception as e: + print(type(e)) diff --git a/tests/basics/int_bytes_notimpl.py.exp b/tests/basics/int_bytes_notimpl.py.exp new file mode 100644 index 0000000000..d1bf338eb6 --- /dev/null +++ b/tests/basics/int_bytes_notimpl.py.exp @@ -0,0 +1,2 @@ +<class 'NotImplementedError'> +<class 'NotImplementedError'> diff --git a/tests/extmod/uctypes_ptr_le.py b/tests/extmod/uctypes_ptr_le.py index 4bff585171..d0216dfb81 100644 --- a/tests/extmod/uctypes_ptr_le.py +++ b/tests/extmod/uctypes_ptr_le.py @@ -14,7 +14,7 @@ desc = { bytes = b"01" addr = uctypes.addressof(bytes) -buf = addr.to_bytes(uctypes.sizeof(desc)) +buf = addr.to_bytes(uctypes.sizeof(desc), "little") S = uctypes.struct(uctypes.addressof(buf), desc, uctypes.LITTLE_ENDIAN) diff --git a/tests/extmod/uctypes_ptr_native_le.py b/tests/extmod/uctypes_ptr_native_le.py index 0d02cfdc8e..6f011c3c2b 100644 --- a/tests/extmod/uctypes_ptr_native_le.py +++ b/tests/extmod/uctypes_ptr_native_le.py @@ -15,7 +15,7 @@ desc = { bytes = b"01" addr = uctypes.addressof(bytes) -buf = addr.to_bytes(uctypes.sizeof(desc)) +buf = addr.to_bytes(uctypes.sizeof(desc), "little") S = uctypes.struct(uctypes.addressof(buf), desc, uctypes.NATIVE) |