@@ -299,11 +299,11 @@ def test_explicit_conversion_overflow() -> None:
299299 assert int(y) == min_i64
300300
301301 too_big = int() + 2**63
302- with assertRaises(OverflowError ):
302+ with assertRaises(ValueError ):
303303 x = i64(too_big)
304304
305305 too_small = int() - 2**63 - 1
306- with assertRaises(OverflowError ):
306+ with assertRaises(ValueError ):
307307 x = i64(too_small)
308308
309309def test_i64_from_large_small_literal() -> None:
@@ -323,9 +323,9 @@ def test_explicit_conversion_from_float() -> None:
323323 assert from_float(2**63 - 1024) == 2**63 - 1024
324324 assert from_float(-2**63) == -2**63
325325 # The error message could be better, but this is acceptable
326- with assertRaises(OverflowError , "int too large to convert to i64"):
326+ with assertRaises(ValueError , "int too large to convert to i64"):
327327 assert from_float(float(2**63))
328- with assertRaises(OverflowError , "int too large to convert to i64"):
328+ with assertRaises(ValueError , "int too large to convert to i64"):
329329 # One ulp below the lowest valid i64 value
330330 from_float(float(-2**63 - 2048))
331331
@@ -430,13 +430,13 @@ def test_mixed_comparisons() -> None:
430430
431431 int_too_big = int() + (1 << 63)
432432 int_too_small = int() - (1 << 63) - 1
433- with assertRaises(OverflowError ):
433+ with assertRaises(ValueError ):
434434 assert i64_3 < int_too_big
435- with assertRaises(OverflowError ):
435+ with assertRaises(ValueError ):
436436 assert int_too_big < i64_3
437- with assertRaises(OverflowError ):
437+ with assertRaises(ValueError ):
438438 assert i64_3 > int_too_small
439- with assertRaises(OverflowError ):
439+ with assertRaises(ValueError ):
440440 assert int_too_small < i64_3
441441
442442def test_mixed_comparisons_32bit() -> None:
@@ -476,9 +476,9 @@ def test_mixed_arithmetic_and_bitwise_ops() -> None:
476476
477477 int_too_big = int() + (1 << 63)
478478 int_too_small = int() - (1 << 63) - 1
479- with assertRaises(OverflowError ):
479+ with assertRaises(ValueError ):
480480 assert i64_3 & int_too_big
481- with assertRaises(OverflowError ):
481+ with assertRaises(ValueError ):
482482 assert int_too_small & i64_3
483483
484484def test_for_loop() -> None:
@@ -591,10 +591,10 @@ def test_unbox_int_fails() -> None:
591591 with assertRaises(TypeError, msg):
592592 x: i64 = o
593593 o2: Any = 1 << 63
594- with assertRaises(OverflowError , "int too large to convert to i64"):
594+ with assertRaises(ValueError , "int too large to convert to i64"):
595595 y: i64 = o2
596596 o3: Any = -(1 << 63 + 1)
597- with assertRaises(OverflowError , "int too large to convert to i64"):
597+ with assertRaises(ValueError , "int too large to convert to i64"):
598598 z: i64 = o3
599599
600600class Uninit:
0 commit comments