mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-27772: Make preceding width with 0 valid in string format. (GH-11270)
Previously it was an error with confusing error message.
This commit is contained in:
parent
8dfe15625e
commit
cf19cc3b92
4 changed files with 15 additions and 3 deletions
|
@ -1098,6 +1098,12 @@ class UnicodeTest(string_tests.CommonTest,
|
|||
self.assertEqual('{0:^8s}'.format('result'), ' result ')
|
||||
self.assertEqual('{0:^9s}'.format('result'), ' result ')
|
||||
self.assertEqual('{0:^10s}'.format('result'), ' result ')
|
||||
self.assertEqual('{0:8s}'.format('result'), 'result ')
|
||||
self.assertEqual('{0:0s}'.format('result'), 'result')
|
||||
self.assertEqual('{0:08s}'.format('result'), 'result00')
|
||||
self.assertEqual('{0:<08s}'.format('result'), 'result00')
|
||||
self.assertEqual('{0:>08s}'.format('result'), '00result')
|
||||
self.assertEqual('{0:^08s}'.format('result'), '0result0')
|
||||
self.assertEqual('{0:10000}'.format('a'), 'a' + ' ' * 9999)
|
||||
self.assertEqual('{0:10000}'.format(''), ' ' * 10000)
|
||||
self.assertEqual('{0:10000000}'.format(''), ' ' * 10000000)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue