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

bpo-45292: Use raw strings for regex in tests #29545

Merged
merged 1 commit into from
Nov 16, 2021
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
6 changes: 3 additions & 3 deletions Lib/test/test_exception_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ def test_bad_EG_construction__bad_message(self):
ExceptionGroup(None, [ValueError(12)])

def test_bad_EG_construction__bad_excs_sequence(self):
MSG = 'second argument \(exceptions\) must be a sequence'
MSG = r'second argument \(exceptions\) must be a sequence'
with self.assertRaisesRegex(TypeError, MSG):
ExceptionGroup('errors not sequence', {ValueError(42)})
with self.assertRaisesRegex(TypeError, MSG):
ExceptionGroup("eg", None)

MSG = 'second argument \(exceptions\) must be a non-empty sequence'
MSG = r'second argument \(exceptions\) must be a non-empty sequence'
with self.assertRaisesRegex(ValueError, MSG):
ExceptionGroup("eg", [])

def test_bad_EG_construction__nested_non_exceptions(self):
MSG = ('Item [0-9]+ of second argument \(exceptions\)'
MSG = (r'Item [0-9]+ of second argument \(exceptions\)'
' is not an exception')
with self.assertRaisesRegex(ValueError, MSG):
ExceptionGroup('expect instance, not type', [OSError]);
Expand Down