Skip to content

Commit e5a9138

Browse files
In test_invalid_input, also accept “(str object cannot be interpreted as an integer)” wherever we expected “an integer is required”; required for Python 3.10 compatibility
1 parent a308a97 commit e5a9138

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/test_codecs.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,11 @@ async def test_unhandled_type_fallback(self):
670670
''')
671671

672672
async def test_invalid_input(self):
673+
# The latter message appears beginning in Python 3.10.
674+
integer_required = (
675+
"(an integer is required|"
676+
"\('str' object cannot be interpreted as an integer\))")
677+
673678
cases = [
674679
('bytea', 'a bytes-like object is required', [
675680
1,
@@ -678,7 +683,7 @@ async def test_invalid_input(self):
678683
('bool', 'a boolean is required', [
679684
1,
680685
]),
681-
('int2', 'an integer is required', [
686+
('int2', integer_required, [
682687
'2',
683688
'aa',
684689
]),
@@ -694,7 +699,7 @@ async def test_invalid_input(self):
694699
4.1 * 10 ** 40,
695700
-4.1 * 10 ** 40,
696701
]),
697-
('int4', 'an integer is required', [
702+
('int4', integer_required, [
698703
'2',
699704
'aa',
700705
]),
@@ -705,7 +710,7 @@ async def test_invalid_input(self):
705710
2**31,
706711
-2**31 - 1,
707712
]),
708-
('int8', 'an integer is required', [
713+
('int8', integer_required, [
709714
'2',
710715
'aa',
711716
]),

0 commit comments

Comments
 (0)