summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unicode.py
diff options
context:
space:
mode:
authorIrit Katriel <iritkatriel@yahoo.com>2021-05-13 20:55:55 (GMT)
committerGitHub <noreply@github.com>2021-05-13 20:55:55 (GMT)
commit4aeee0b47b3a2b604bbac37040320ffc88c291f2 (patch)
tree1e33802dd3bcc1c4d7590aabb985bc787eca1d81 /Lib/test/test_unicode.py
parentae3c66acb89a6104fcd0eea760f80a0287327cc4 (diff)
downloadcpython-4aeee0b47b3a2b604bbac37040320ffc88c291f2.zip
cpython-4aeee0b47b3a2b604bbac37040320ffc88c291f2.tar.gz
cpython-4aeee0b47b3a2b604bbac37040320ffc88c291f2.tar.bz2
bpo-28146: Fix a confusing error message in str.format() (GH-24213)
Automerge-Triggered-By: GH:pitrou
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r--Lib/test/test_unicode.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 6f5d40f..ffe3e82 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -1231,8 +1231,11 @@ class UnicodeTest(string_tests.CommonTest,
0, 1, 2, 3, 4, 5, 6, 7)
# string format spec errors
- self.assertRaises(ValueError, "{0:-s}".format, '')
- self.assertRaises(ValueError, format, "", "-")
+ sign_msg = "Sign not allowed in string format specifier"
+ self.assertRaisesRegex(ValueError, sign_msg, "{0:-s}".format, '')
+ self.assertRaisesRegex(ValueError, sign_msg, format, "", "-")
+ space_msg = "Space not allowed in string format specifier"
+ self.assertRaisesRegex(ValueError, space_msg, "{: }".format, '')
self.assertRaises(ValueError, "{0:=s}".format, '')
# Alternate formatting is not supported