mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
bpo-28146: Fix a confusing error message in str.format() (GH-24213)
Automerge-Triggered-By: GH:pitrou
(cherry picked from commit 4aeee0b47b
)
Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
This commit is contained in:
parent
c4c3beb5ad
commit
2d780237d9
3 changed files with 14 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue