py/objstr: Simplify error handling for bad conversion specifier.

This commit is contained in:
Damien George
2015-08-30 12:43:21 +01:00
parent c9fa667252
commit 000730ecaa
2 changed files with 20 additions and 10 deletions

View File

@@ -140,6 +140,13 @@ try:
except ValueError:
print('ValueError')
# end of format parsing conversion specifier
try:
'{!'.format('a')
except ValueError:
print('ValueError')
# unknown conversion specifier
try:
'abc{!d}'.format('1')
except ValueError:
@@ -150,6 +157,7 @@ try:
except ValueError:
print('ValueError')
# expected ':' after specifier
try:
'{!s :}'.format(2)
except ValueError: