From 3b09dca046634e5ff6cdf97a77bbeab922f7ba2d Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 21 Jan 2017 20:15:31 +0300 Subject: 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. --- tests/basics/int_bytes_long.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/basics/int_bytes_long.py (limited to 'tests/basics/int_bytes_long.py') diff --git a/tests/basics/int_bytes_long.py b/tests/basics/int_bytes_long.py new file mode 100644 index 000000000..81ebc6cdc --- /dev/null +++ b/tests/basics/int_bytes_long.py @@ -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")) -- cgit v1.2.3