Fixed issue #25034: Fix string.Formatter problem with auto-numbering

and nested format_specs. Patch by Anthon van der Neut.
This commit is contained in:
Eric V. Smith 2015-09-29 10:27:38 -04:00
parent b8b951f6ee
commit 85976b14dd
4 changed files with 12 additions and 5 deletions

View file

@ -54,6 +54,8 @@ class ModuleTest(unittest.TestCase):
'foo{1}{num}{1}'.format(None, 'bar', num=6))
self.assertEqual(fmt.format('{:^{}}', 'bar', 6),
'{:^{}}'.format('bar', 6))
self.assertEqual(fmt.format('{:^{}} {}', 'bar', 6, 'X'),
'{:^{}} {}'.format('bar', 6, 'X'))
self.assertEqual(fmt.format('{:^{pad}}{}', 'foo', 'bar', pad=6),
'{:^{pad}}{}'.format('foo', 'bar', pad=6))