Skip to content

Commit 3b09dca

Browse files
committed
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.
1 parent e6ab43e commit 3b09dca

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

tests/basics/int_bytes_long.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
b = bytes(range(20))
2+
3+
il = int.from_bytes(b, "little")
4+
ib = int.from_bytes(b, "big")
5+
print(il)
6+
print(ib)
7+
print(il.to_bytes(20, "little"))

tests/basics/int_bytes_notimpl.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,3 @@
22
print((10).to_bytes(1, "big"))
33
except Exception as e:
44
print(type(e))
5-
6-
try:
7-
print(int.from_bytes(b"\0", "big"))
8-
except Exception as e:
9-
print(type(e))
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
<class 'NotImplementedError'>
2-
<class 'NotImplementedError'>

0 commit comments

Comments
 (0)