Skip to content

Commit

Permalink
tests/basics: Add tests for optional args to int.to_bytes/from_bytes.
Browse files Browse the repository at this point in the history
Signed-off-by: Amirreza Hamzavi <amirrezahamzavi2000@gmail.com>
  • Loading branch information
AmirHmZz authored and dpgeorge committed Sep 2, 2024
1 parent cb7e990 commit 1897fe6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/basics/int_bytes_optional_args_cp311.py
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions tests/basics/int_bytes_optional_args_cp311.py.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
b'\n'
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00d'
1
256
b'\n'
b'd'

0 comments on commit 1897fe6

Please sign in to comment.