From aee13ef3f219a7a2e19c017323694b946d500d14 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky <pfalcon@users.sourceforge.net> Date: Fri, 9 Dec 2016 22:53:30 +0300 Subject: [PATCH] tests: Update for required byteorder arg for int.from_bytes()/to_bytes(). --- tests/basics/int_bytes_notimpl.py | 9 +++++++++ tests/basics/int_bytes_notimpl.py.exp | 2 ++ tests/extmod/uctypes_ptr_le.py | 2 +- tests/extmod/uctypes_ptr_native_le.py | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 tests/basics/int_bytes_notimpl.py create mode 100644 tests/basics/int_bytes_notimpl.py.exp diff --git a/tests/basics/int_bytes_notimpl.py b/tests/basics/int_bytes_notimpl.py new file mode 100644 index 000000000..b47d6ab58 --- /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 000000000..d1bf338eb --- /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 4bff58517..d0216dfb8 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 0d02cfdc8..6f011c3c2 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) -- GitLab