tests/basics: Add tests for optional args to int.to_bytes/from_bytes.
Signed-off-by: Amirreza Hamzavi <amirrezahamzavi2000@gmail.com>
This commit is contained in:
parent
cb7e99098e
commit
1897fe6227
9
tests/basics/int_bytes_optional_args_cp311.py
Normal file
9
tests/basics/int_bytes_optional_args_cp311.py
Normal file
@ -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())
|
||||||
6
tests/basics/int_bytes_optional_args_cp311.py.exp
Normal file
6
tests/basics/int_bytes_optional_args_cp311.py.exp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
b'\n'
|
||||||
|
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00d'
|
||||||
|
1
|
||||||
|
256
|
||||||
|
b'\n'
|
||||||
|
b'd'
|
||||||
Loading…
x
Reference in New Issue
Block a user