@@ -15,10 +15,10 @@ def test_box_and_unbox() -> None:
1515 o2: Any = x
1616 assert o == o2
1717 assert x == i
18- with assertRaises(OverflowError , "int too large to convert to i16"):
18+ with assertRaises(ValueError , "int too large to convert to i16"):
1919 o = 2**15
2020 x2: i16 = o
21- with assertRaises(OverflowError , "int too large to convert to i16"):
21+ with assertRaises(ValueError , "int too large to convert to i16"):
2222 o = -2**15 - 1
2323 x3: i16 = o
2424
@@ -209,13 +209,13 @@ def test_mixed_comparisons() -> None:
209209
210210 int_too_big = int() + (1 << 15)
211211 int_too_small = int() - (1 << 15) - 1
212- with assertRaises(OverflowError ):
212+ with assertRaises(ValueError ):
213213 assert i16_3 < int_too_big
214- with assertRaises(OverflowError ):
214+ with assertRaises(ValueError ):
215215 assert int_too_big < i16_3
216- with assertRaises(OverflowError ):
216+ with assertRaises(ValueError ):
217217 assert i16_3 > int_too_small
218- with assertRaises(OverflowError ):
218+ with assertRaises(ValueError ):
219219 assert int_too_small < i16_3
220220
221221def test_mixed_arithmetic_and_bitwise_ops() -> None:
@@ -235,9 +235,9 @@ def test_mixed_arithmetic_and_bitwise_ops() -> None:
235235
236236 int_too_big = int() + (1 << 15)
237237 int_too_small = int() - (1 << 15) - 1
238- with assertRaises(OverflowError ):
238+ with assertRaises(ValueError ):
239239 assert i16_3 & int_too_big
240- with assertRaises(OverflowError ):
240+ with assertRaises(ValueError ):
241241 assert int_too_small & i16_3
242242
243243def test_coerce_to_and_from_int() -> None:
@@ -277,11 +277,11 @@ def test_explicit_conversion_overflow() -> None:
277277 assert int(y) == min_i16
278278
279279 too_big = int() + 2**15
280- with assertRaises(OverflowError ):
280+ with assertRaises(ValueError ):
281281 x = i16(too_big)
282282
283283 too_small = int() - 2**15 - 1
284- with assertRaises(OverflowError ):
284+ with assertRaises(ValueError ):
285285 x = i16(too_small)
286286
287287def test_i16_from_large_small_literal() -> None:
@@ -320,9 +320,9 @@ def test_explicit_conversion_from_float() -> None:
320320 assert from_float(2**15 - 1) == 2**15 - 1
321321 assert from_float(-2**15) == -2**15
322322 # The error message could be better, but this is acceptable
323- with assertRaises(OverflowError , "int too large to convert to i16"):
323+ with assertRaises(ValueError , "int too large to convert to i16"):
324324 assert from_float(float(2**15))
325- with assertRaises(OverflowError , "int too large to convert to i16"):
325+ with assertRaises(ValueError , "int too large to convert to i16"):
326326 # One ulp below the lowest valid i64 value
327327 from_float(float(-2**15 - 1))
328328
0 commit comments