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

Use assertRaisesRegex instead of assertRaisesRegexp for Python 3.12 compatibility #445

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,12 @@ def test_auth_code_flow(self):
self.assertLoosely(result, lambda: self.assertIn('access_token', result))

def test_auth_code_flow_error_response(self):
with self.assertRaisesRegexp(ValueError, "state missing"):
assertRaisesRegex = getattr(self, "assertRaisesRegex", self.assertRaisesRegexp)
with assertRaisesRegex(ValueError, "state missing"):
self.client.obtain_token_by_auth_code_flow({}, {"code": "foo"})
with self.assertRaisesRegexp(ValueError, "state mismatch"):
with assertRaisesRegex(ValueError, "state mismatch"):
self.client.obtain_token_by_auth_code_flow({"state": "1"}, {"state": "2"})
with self.assertRaisesRegexp(ValueError, "scope"):
with assertRaisesRegex(ValueError, "scope"):
self.client.obtain_token_by_auth_code_flow(
{"state": "s", "scope": ["foo"]}, {"state": "s"}, scope=["bar"])
self.assertEqual(
Expand Down