mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Apply the second version of SF patch http://www.python.org/sf/536241
Add a method zfill to str, unicode and UserString and change Lib/string.py accordingly. This activates the zfill version in unicodeobject.c that was commented out and implements the same in stringobject.c. It also adds the test for unicode support in Lib/string.py back in and uses repr() instead() of str() (as it was before Lib/string.py 1.62)
This commit is contained in:
parent
b384c72639
commit
068325ef92
8 changed files with 83 additions and 13 deletions
|
@ -206,8 +206,18 @@ if 0:
|
|||
test('capwords', u'abc\tdef\nghi', u'Abc Def Ghi')
|
||||
test('capwords', u'abc\t def \nghi', u'Abc Def Ghi')
|
||||
|
||||
verify(string.zfill(u'34', 1) == u'34')
|
||||
verify(string.zfill(u'34', 5) == u'00034')
|
||||
test('zfill', u'123', u'123', 2)
|
||||
test('zfill', u'123', u'123', 3)
|
||||
test('zfill', u'123', u'0123', 4)
|
||||
test('zfill', u'+123', u'+123', 3)
|
||||
test('zfill', u'+123', u'+123', 4)
|
||||
test('zfill', u'+123', u'+0123', 5)
|
||||
test('zfill', u'-123', u'-123', 3)
|
||||
test('zfill', u'-123', u'-123', 4)
|
||||
test('zfill', u'-123', u'-0123', 5)
|
||||
test('zfill', u'', u'000', 3)
|
||||
test('zfill', u'34', u'34', 1)
|
||||
test('zfill', u'34', u'00034', 5)
|
||||
|
||||
# Comparisons:
|
||||
print 'Testing Unicode comparisons...',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue