Skip to content

Commit 831c883

Browse files
committed
Add tests for integer
1 parent c8d0f5c commit 831c883

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/snippets/ints.py

+21
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,24 @@ def __int__(self):
232232
assert_raises(TypeError, lambda: (1).__round__(None))
233233
assert_raises(TypeError, lambda: (0).__round__(0.0))
234234
assert_raises(TypeError, lambda: (1).__round__(0.0))
235+
236+
assert 00 == 0
237+
assert 0_0 == 0
238+
assert 03.2 == 3.2
239+
assert 3+02j == 3+2j
240+
241+
# Invalid syntax:
242+
src = """
243+
b = 02
244+
"""
245+
246+
with assert_raises(SyntaxError):
247+
exec(src)
248+
249+
# Invalid syntax:
250+
src = """
251+
b = 03 + 2j
252+
"""
253+
254+
with assert_raises(SyntaxError):
255+
exec(src)

0 commit comments

Comments
 (0)