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.
pull/2802/head
Paul Sokolovsky 2017-01-21 20:15:31 +03:00
rodzic e6ab43e2c0
commit 3b09dca046
3 zmienionych plików z 7 dodań i 6 usunięć

Wyświetl plik

@ -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"))

Wyświetl plik

@ -2,8 +2,3 @@ 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))

Wyświetl plik

@ -1,2 +1 @@
<class 'NotImplementedError'>
<class 'NotImplementedError'>