mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
gh-106487: Allow the 'count' argument of str.replace
to be a keyword (#106488)
This commit is contained in:
parent
dac1e36490
commit
34c14147a2
6 changed files with 54 additions and 14 deletions
|
@ -154,6 +154,12 @@ class BaseTest:
|
|||
self.assertEqual(rem, 0, '%s != 0 for %s' % (rem, i))
|
||||
self.assertEqual(r1, r2, '%s != %s for %s' % (r1, r2, i))
|
||||
|
||||
def test_count_keyword(self):
|
||||
self.assertEqual('aa'.replace('a', 'b', 0), 'aa'.replace('a', 'b', count=0))
|
||||
self.assertEqual('aa'.replace('a', 'b', 1), 'aa'.replace('a', 'b', count=1))
|
||||
self.assertEqual('aa'.replace('a', 'b', 2), 'aa'.replace('a', 'b', count=2))
|
||||
self.assertEqual('aa'.replace('a', 'b', 3), 'aa'.replace('a', 'b', count=3))
|
||||
|
||||
def test_find(self):
|
||||
self.checkequal(0, 'abcdefghiabc', 'find', 'abc')
|
||||
self.checkequal(9, 'abcdefghiabc', 'find', 'abc', 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue