tests/int_bytes: Add tests for optional arguments.

Signed-off-by: Amirreza Hamzavi <amirrezahamzavi2000@gmail.com>
pull/14387/head
Amirreza Hamzavi 2024-04-30 19:32:26 +03:30
rodzic f8961ea74c
commit ca84705f4e
2 zmienionych plików z 15 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,9 @@
# Check optional byteorder argument (CPython 3.11+)
print((10).to_bytes(1))
print((100).to_bytes(10))
print(int.from_bytes(b"\0\0\0\0\0\0\0\0\0\x01"))
print(int.from_bytes(b"\x01\0"))
# Check optional length argument (CPython 3.11+)
print((10).to_bytes())
print((100).to_bytes())

Wyświetl plik

@ -0,0 +1,6 @@
b'\n'
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00d'
1
256
b'\n'
b'd'