Skip to content

Commit 6ea3af3

Browse files
committed
Fix exception assert message checks
1 parent e5b03e8 commit 6ea3af3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Lib/test/test_tstring.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@ def test_template_concatenation(self):
160160

161161
# Test template + string
162162
t1 = t"Hello"
163-
expected_msg = 'can only concatenate Template (not "str") to Template'
164-
with self.assertRaises(TypeError, msg=expected_msg):
163+
expected_msg = 'can only concatenate string.templatelib.Template ' \
164+
'\\(not "str"\\) to string.templatelib.Template'
165+
with self.assertRaisesRegex(TypeError, expected_msg):
165166
t1 + ", world"
166167

167168
# Test template + template with interpolation
@@ -173,8 +174,9 @@ def test_template_concatenation(self):
173174
self.assertEqual(fstring(combined), "Hello, Python")
174175

175176
# Test string + template
176-
expected_msg = 'can only concatenate str (not "string.templatelib.Template") to str'
177-
with self.assertRaises(TypeError, msg=expected_msg):
177+
expected_msg = 'can only concatenate str ' \
178+
'\\(not "string.templatelib.Template"\\) to str'
179+
with self.assertRaisesRegex(TypeError, expected_msg):
178180
"Hello, " + t"{name}"
179181

180182
def test_nested_templates(self):

0 commit comments

Comments
 (0)