tests/extmod: Use bytearray instead of bytes for uctypes test.
Because the test modifies the (now) bytearray object, and if it's a bytes object it's not guaranteed that it can be modified, or that this constant object isn't used elsewhere. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
8588525868
commit
80938839c1
@ -6,7 +6,7 @@ except ImportError:
|
|||||||
print("SKIP")
|
print("SKIP")
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
|
|
||||||
buf = b"12345678abcd"
|
buf = bytearray(b"12345678abcd")
|
||||||
struct = uctypes.struct(
|
struct = uctypes.struct(
|
||||||
uctypes.addressof(buf),
|
uctypes.addressof(buf),
|
||||||
{"f32": uctypes.UINT32 | 0, "f64": uctypes.UINT64 | 4},
|
{"f32": uctypes.UINT32 | 0, "f64": uctypes.UINT64 | 4},
|
||||||
@ -30,7 +30,7 @@ print(buf)
|
|||||||
|
|
||||||
print("=")
|
print("=")
|
||||||
|
|
||||||
buf = b"12345678abcd"
|
buf = bytearray(b"12345678abcd")
|
||||||
struct = uctypes.struct(
|
struct = uctypes.struct(
|
||||||
uctypes.addressof(buf),
|
uctypes.addressof(buf),
|
||||||
{"f32": uctypes.UINT32 | 0, "f64": uctypes.UINT64 | 4},
|
{"f32": uctypes.UINT32 | 0, "f64": uctypes.UINT64 | 4},
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
b'\xff\xff\xff\x7f5678abcd'
|
bytearray(b'\xff\xff\xff\x7f5678abcd')
|
||||||
b'\x00\x00\x00\x805678abcd'
|
bytearray(b'\x00\x00\x00\x805678abcd')
|
||||||
b'\x03\x02\x01\xff5678abcd'
|
bytearray(b'\x03\x02\x01\xff5678abcd')
|
||||||
b'\x03\x02\x01\xff\x00\x00\x00\x80\x00\x00\x00\x00'
|
bytearray(b'\x03\x02\x01\xff\x00\x00\x00\x80\x00\x00\x00\x00')
|
||||||
b'\x03\x02\x01\xff\x00\x00\x00\x00\x01\x00\x00\x00'
|
bytearray(b'\x03\x02\x01\xff\x00\x00\x00\x00\x01\x00\x00\x00')
|
||||||
=
|
=
|
||||||
b'\x7f\xff\xff\xff5678abcd'
|
bytearray(b'\x7f\xff\xff\xff5678abcd')
|
||||||
b'\x80\x00\x00\x005678abcd'
|
bytearray(b'\x80\x00\x00\x005678abcd')
|
||||||
b'\xff\x01\x02\x035678abcd'
|
bytearray(b'\xff\x01\x02\x035678abcd')
|
||||||
b'\xff\x01\x02\x03\x00\x00\x00\x00\x80\x00\x00\x00'
|
bytearray(b'\xff\x01\x02\x03\x00\x00\x00\x00\x80\x00\x00\x00')
|
||||||
b'\xff\x01\x02\x03\x00\x00\x00\x01\x00\x00\x00\x00'
|
bytearray(b'\xff\x01\x02\x03\x00\x00\x00\x01\x00\x00\x00\x00')
|
||||||
|
Loading…
Reference in New Issue
Block a user