mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 04:00:28 +01:00
tests: Update for required byteorder arg for int.from_bytes()/to_bytes().
This commit is contained in:
9
tests/basics/int_bytes_notimpl.py
Normal file
9
tests/basics/int_bytes_notimpl.py
Normal file
@@ -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))
|
||||
2
tests/basics/int_bytes_notimpl.py.exp
Normal file
2
tests/basics/int_bytes_notimpl.py.exp
Normal file
@@ -0,0 +1,2 @@
|
||||
<class 'NotImplementedError'>
|
||||
<class 'NotImplementedError'>
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user