Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loosen message test in test_invalid_input #751

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions tests/test_codecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,11 @@ async def test_unhandled_type_fallback(self):
''')

async def test_invalid_input(self):
# The latter message appears beginning in Python 3.10.
integer_required = (
r"(an integer is required|"
r"\('str' object cannot be interpreted as an integer\))")

cases = [
('bytea', 'a bytes-like object is required', [
1,
Expand All @@ -678,7 +683,7 @@ async def test_invalid_input(self):
('bool', 'a boolean is required', [
1,
]),
('int2', 'an integer is required', [
('int2', integer_required, [
'2',
'aa',
]),
Expand All @@ -694,7 +699,7 @@ async def test_invalid_input(self):
4.1 * 10 ** 40,
-4.1 * 10 ** 40,
]),
('int4', 'an integer is required', [
('int4', integer_required, [
'2',
'aa',
]),
Expand All @@ -705,7 +710,7 @@ async def test_invalid_input(self):
2**31,
-2**31 - 1,
]),
('int8', 'an integer is required', [
('int8', integer_required, [
'2',
'aa',
]),
Expand Down