closes bpo-34868: Improve error message with '_' is combined with an invalid type specifier. (GH-9666)
(cherry picked from commit cbda8fc5d76b10bcbb92d927537576c229143836)
Co-authored-by: Benjamin Peterson <benjamin@python.org>
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py
index 8472889..b4a99e3 100644
--- a/Lib/test/test_long.py
+++ b/Lib/test/test_long.py
@@ -699,6 +699,9 @@
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)]):