mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
bpo-45292: Use raw strings for regex in tests (GH-29545)
This commit is contained in:
parent
b931077375
commit
8b06d01507
1 changed files with 3 additions and 3 deletions
|
|
@ -38,18 +38,18 @@ class BadConstructorArgs(unittest.TestCase):
|
||||||
ExceptionGroup(None, [ValueError(12)])
|
ExceptionGroup(None, [ValueError(12)])
|
||||||
|
|
||||||
def test_bad_EG_construction__bad_excs_sequence(self):
|
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):
|
with self.assertRaisesRegex(TypeError, MSG):
|
||||||
ExceptionGroup('errors not sequence', {ValueError(42)})
|
ExceptionGroup('errors not sequence', {ValueError(42)})
|
||||||
with self.assertRaisesRegex(TypeError, MSG):
|
with self.assertRaisesRegex(TypeError, MSG):
|
||||||
ExceptionGroup("eg", None)
|
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):
|
with self.assertRaisesRegex(ValueError, MSG):
|
||||||
ExceptionGroup("eg", [])
|
ExceptionGroup("eg", [])
|
||||||
|
|
||||||
def test_bad_EG_construction__nested_non_exceptions(self):
|
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')
|
' is not an exception')
|
||||||
with self.assertRaisesRegex(ValueError, MSG):
|
with self.assertRaisesRegex(ValueError, MSG):
|
||||||
ExceptionGroup('expect instance, not type', [OSError]);
|
ExceptionGroup('expect instance, not type', [OSError]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue