[Python-checkins] python/dist/src/Lib/test string_tests.py,1.23,1.24 test_descr.py,1.155,1.156 test_unicode.py,1.66,1.67

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Fri, 23 Aug 2002 11:21:30 -0700


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

Modified Files:
	string_tests.py test_descr.py test_unicode.py 
Log Message:
Code by Inyeol Lee, submitted to SF bug 595350, to implement
the string/unicode method .replace() with a zero-lengt first argument.
Inyeol contributed tests for this too.


Index: string_tests.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** string_tests.py	9 Aug 2002 01:37:06 -0000	1.23
--- string_tests.py	23 Aug 2002 18:21:26 -0000	1.24
***************
*** 203,206 ****
--- 203,210 ----
      test('replace', 'one!two!three!', 'one!two!three!', 'x', '@')
      test('replace', 'one!two!three!', 'one!two!three!', 'x', '@', 2)
+     test('replace', 'abc', '-a-b-c-', '', '-')
+     test('replace', 'abc', '-a-b-c', '', '-', 3)
+     test('replace', 'abc', 'abc', '', '-', 0)
+     test('replace', '', '', '', '')
      # Next three for SF bug 422088: [OSF1 alpha] string.replace(); died with
      # MemoryError due to empty result (platform malloc issue when requesting

Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.155
retrieving revision 1.156
diff -C2 -d -r1.155 -r1.156
*** test_descr.py	13 Aug 2002 18:26:26 -0000	1.155
--- test_descr.py	23 Aug 2002 18:21:26 -0000	1.156
***************
*** 2997,3004 ****
      else: raise TestFailed, "''.rindex('5') doesn't raise ValueError"
  
-     try: ''.replace('', '')
-     except ValueError: pass
-     else: raise TestFailed, "''.replace('', '') doesn't raise ValueError"
- 
      try: '%(n)s' % None
      except TypeError: pass
--- 2997,3000 ----

Index: test_unicode.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** test_unicode.py	20 Aug 2002 17:29:28 -0000	1.66
--- test_unicode.py	23 Aug 2002 18:21:26 -0000	1.67
***************
*** 211,220 ****
  test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@')
  test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@', 2)
! try:
!     u"abc".replace(u"", u"x")
! except ValueError:
!     pass
! else:
!     raise TestFailed, "u.replace('', ...) should raise ValueError"
  
  test('startswith', u'hello', True, u'he')
--- 211,218 ----
  test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@')
  test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@', 2)
! test('replace', u'abc', u'-a-b-c-', u'', u'-')
! test('replace', u'abc', u'-a-b-c', u'', u'-', 3)
! test('replace', u'abc', u'abc', u'', u'-', 0)
! test('replace', u'', u'', u'', u'')
  
  test('startswith', u'hello', True, u'he')