closes bpo-34868: Improve error message with '_' is combined with an invalid type specifier. (GH-9666)

This commit is contained in:
Benjamin Peterson 2018-10-01 21:54:39 -07:00 committed by GitHub
parent 30534cc717
commit cbda8fc5d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View file

@ -700,6 +700,9 @@ class LongTest(unittest.TestCase):
self.assertRaisesRegex(ValueError, 'Cannot specify both', format, 3, '_,d')
self.assertRaisesRegex(ValueError, 'Cannot specify both', format, 3, ',_d')
self.assertRaisesRegex(ValueError, "Cannot specify ',' with 's'", format, 3, ',s')
self.assertRaisesRegex(ValueError, "Cannot specify '_' with 's'", format, 3, '_s')
# ensure that only int and float type specifiers work
for format_spec in ([chr(x) for x in range(ord('a'), ord('z')+1)] +
[chr(x) for x in range(ord('A'), ord('Z')+1)]):