Skip to content

Commit 987ad12

Browse files
committed
relocate int-unrelated tests to proper files
1 parent ab7971d commit 987ad12

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

extra_tests/snippets/builtin_complex.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
# __eq__
1111

12+
assert 3+02j == 3+2j
1213
assert complex(1, -1) == complex(1, -1)
1314
assert complex(1, 0) == 1
1415
assert 1 == complex(1, 0)
@@ -212,16 +213,22 @@ def __eq__(self, other):
212213
assert complex('-1e-500+1e-500j') == -0.0 + 0.0j
213214

214215

216+
# Invalid syntax:
217+
src = """
218+
b = 03 + 2j
219+
"""
220+
221+
with assert_raises(SyntaxError):
222+
exec(src)
223+
224+
215225
# __complex__
216-
def test__complex__():
217-
z = 3 + 4j
218-
assert z.__complex__() == z
219-
assert type(z.__complex__()) == complex
220-
221-
class complex_subclass(complex):
222-
pass
223-
z = complex_subclass(3 + 4j)
224-
assert z.__complex__() == 3 + 4j
225-
assert type(z.__complex__()) == complex
226-
227-
testutils.skip_if_unsupported(3, 11, test__complex__)
226+
z = 3 + 4j
227+
assert z.__complex__() == z
228+
assert type(z.__complex__()) == complex
229+
230+
class complex_subclass(complex):
231+
pass
232+
z = complex_subclass(3 + 4j)
233+
assert z.__complex__() == 3 + 4j
234+
assert type(z.__complex__()) == complex

extra_tests/snippets/builtin_float.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
assert hash(0.0) == hash(False)
117117
assert hash(1.0) != hash(1.0000000001)
118118

119+
assert 03.2 == 3.2
119120
assert 5.0 in {3, 4, 5}
120121
assert {-1: 2}[-1.0] == 2
121122

extra_tests/snippets/builtin_int.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -301,22 +301,12 @@ def __int__(self):
301301

302302
assert 00 == 0
303303
assert 0_0 == 0
304-
assert 03.2 == 3.2
305-
assert 3+02j == 3+2j
306304

307305
# Invalid syntax:
308306
src = """
309307
b = 02
310308
"""
311309

312-
with assert_raises(SyntaxError):
313-
exec(src)
314-
315-
# Invalid syntax:
316-
src = """
317-
b = 03 + 2j
318-
"""
319-
320310
with assert_raises(SyntaxError):
321311
exec(src)
322312

0 commit comments

Comments
 (0)