We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b24444e commit 7c42a18Copy full SHA for 7c42a18
1 file changed
tests/snippets/ints.py
@@ -90,6 +90,10 @@
90
assert int("101", 2) == 5
91
assert int("101", base=2) == 5
92
assert int(1) == 1
93
+assert int(' 1') == 1
94
+assert int('1 ') == 1
95
+assert int(' 1 ') == 1
96
+assert int('10', base=0) == 10
97
98
assert int.from_bytes(b'\x00\x10', 'big') == 16
99
assert int.from_bytes(b'\x00\x10', 'little') == 4096
@@ -103,6 +107,13 @@
103
107
assert (2147483647).to_bytes(8, 'big', signed=False) == b'\x00\x00\x00\x00\x7f\xff\xff\xff'
104
108
assert (-2147483648).to_bytes(8, 'little', signed=True) == b'\x00\x00\x00\x80\xff\xff\xff\xff'
105
109
110
+with assertRaises(ValueError):
111
+ # check base first
112
+ int(' 1 ', base=1)
113
+
114
115
+ int(' 1 ', base=37)
116
106
117
with assertRaises(TypeError):
118
int(base=2)
119
0 commit comments