tests: Add test for int.from_bytes() for arbitrary-precision integer.
This test works only for MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_MPZ and needs a way of skipping in other cases.
This commit is contained in:
parent
e6ab43e2c0
commit
3b09dca046
7
tests/basics/int_bytes_long.py
Normal file
7
tests/basics/int_bytes_long.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
b = bytes(range(20))
|
||||||
|
|
||||||
|
il = int.from_bytes(b, "little")
|
||||||
|
ib = int.from_bytes(b, "big")
|
||||||
|
print(il)
|
||||||
|
print(ib)
|
||||||
|
print(il.to_bytes(20, "little"))
|
@ -2,8 +2,3 @@ try:
|
|||||||
print((10).to_bytes(1, "big"))
|
print((10).to_bytes(1, "big"))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(type(e))
|
print(type(e))
|
||||||
|
|
||||||
try:
|
|
||||||
print(int.from_bytes(b"\0", "big"))
|
|
||||||
except Exception as e:
|
|
||||||
print(type(e))
|
|
||||||
|
@ -1,2 +1 @@
|
|||||||
<class 'NotImplementedError'>
|
<class 'NotImplementedError'>
|
||||||
<class 'NotImplementedError'>
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user