]> granicus.if.org Git - python/commitdiff
Added tests of strop.replace()
authorBarry Warsaw <barry@python.org>
Sat, 29 Nov 1997 00:25:30 +0000 (00:25 +0000)
committerBarry Warsaw <barry@python.org>
Sat, 29 Nov 1997 00:25:30 +0000 (00:25 +0000)
Lib/test/test_strop.py

index efc98ff04e6e856509ad487ce51d55bf212702c3..9243ff48ef011b1be5f543ac3441e6d7aae88d76 100644 (file)
@@ -67,6 +67,15 @@ test('rstrip', '   hello   ', '   hello')
 test('swapcase', 'HeLLo cOmpUteRs', 'hEllO CoMPuTErS')
 test('translate', 'xyzabcdef', 'xyzxyz', transtable, 'def')
 
+test('replace', 'one!two!three!', 'one@two!three!', '!', '@', 1)
+test('replace', 'one!two!three!', 'one@two@three!', '!', '@', 2)
+test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 3)
+test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 4)
+test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 0)
+test('replace', 'one!two!three!', 'one@two@three@', '!', '@')
+test('replace', 'one!two!three!', 'one!two!three!', 'x', '@')
+test('replace', 'one!two!three!', 'one!two!three!', 'x', '@', 2)
+
 strop.whitespace
 strop.lowercase
 strop.uppercase