summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/int_bytes_intbig.py
blob: 0e0ad1cbb772e7c3b7a0104317e3837bbe17a398 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
print((2**64).to_bytes(9, "little"))

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

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