8000 tests/basics: Add tests for optional args to int.to_bytes/from_bytes. · cuatrobits/micropython@1897fe6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1897fe6

Browse files
AmirHmZzdpgeorge
authored andcommitted
tests/basics: Add tests for optional args to int.to_bytes/from_bytes.
Signed-off-by: Amirreza Hamzavi <amirrezahamzavi2000@gmail.com>
1 parent cb7e990 commit 1897fe6

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Check optional byteorder argument (CPython 3.11+)
2+
print((10).to_bytes(1))
3+
print((100).to_bytes(10))
4+
print(int.from_bytes(b"\0\0\0\0\0\0\0\0\0\x01"))
5+
print(int.from_bytes(b"\x01\0"))
6+
7+
# Check optional length argument (CPython 3.11+)
8+
print((10).to_bytes())
9+
print((100).to_bytes())
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
b'\n'
2+
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00d'
3+
1
4+
256
5+
b'\n'
6+
b'd'

0 commit comments

Comments
 (0)
0