From 810133d97d4391151e86af90508222c480f362b7 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 25 Apr 2017 12:07:02 +1000 Subject: tests/basics: Add tests for int.from_bytes when src has trailing zeros. The trailing zeros should be truncated from the converted value. --- tests/basics/int_bytes_intbig.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/basics/int_bytes_intbig.py') diff --git a/tests/basics/int_bytes_intbig.py b/tests/basics/int_bytes_intbig.py index 39cd67d26..0e0ad1cbb 100644 --- a/tests/basics/int_bytes_intbig.py +++ b/tests/basics/int_bytes_intbig.py @@ -7,3 +7,6 @@ ib = int.from_bytes(b, "big") print(il) print(ib) print(il.to_bytes(20, "little")) + +# check that extra zero bytes don't change the internal int value +print(int.from_bytes(b + bytes(10), "little") == int.from_bytes(b, "little")) -- cgit v1.2.3