[Python-checkins] python/dist/src/Lib/test string_tests.py,1.12,1.13 test_unicode.py,1.53,1.54

doerwalter@sourceforge.net doerwalter@sourceforge.net
Mon, 15 Apr 2002 06:37:16 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv32693/Lib/test

Modified Files:
	string_tests.py test_unicode.py 
Log Message:
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)


Index: string_tests.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** string_tests.py	13 Apr 2002 00:56:08 -0000	1.12
--- string_tests.py	15 Apr 2002 13:36:43 -0000	1.13
***************
*** 228,231 ****
--- 228,241 ----
      test('endswith', 'ab', 0, 'ab', 0, 0)
  
+     test('zfill', '123', '123', 2)
+     test('zfill', '123', '123', 3)
+     test('zfill', '123', '0123', 4)
+     test('zfill', '+123', '+123', 3)
+     test('zfill', '+123', '+123', 4)
+     test('zfill', '+123', '+0123', 5)
+     test('zfill', '-123', '-123', 3)
+     test('zfill', '-123', '-123', 4)
+     test('zfill', '-123', '-0123', 5)
+     test('zfill', '', '000', 3)
      test('zfill', '34', '34', 1)
      test('zfill', '34', '0034', 4)

Index: test_unicode.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** test_unicode.py	10 Apr 2002 17:18:01 -0000	1.53
--- test_unicode.py	15 Apr 2002 13:36:44 -0000	1.54
***************
*** 207,212 ****
      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')
  
  # Comparisons:
--- 207,222 ----
      test('capwords', u'abc\t   def  \nghi', u'Abc Def Ghi')
  
! 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: