diff options
author | Hugo van Kemenade <hugovk@users.noreply.github.com> | 2023-07-10 09:52:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-10 09:52:36 (GMT) |
commit | 34c14147a2c52930b8b471905074509639e82d5b (patch) | |
tree | b621b5415d714b9ecfe1886ec6e3fdad2295682b /Lib/test/string_tests.py | |
parent | dac1e364901d3668742e6eecc2ce63586330c11f (diff) | |
download | cpython-34c14147a2c52930b8b471905074509639e82d5b.zip cpython-34c14147a2c52930b8b471905074509639e82d5b.tar.gz cpython-34c14147a2c52930b8b471905074509639e82d5b.tar.bz2 |
gh-106487: Allow the 'count' argument of `str.replace` to be a keyword (#106488)
Diffstat (limited to 'Lib/test/string_tests.py')
-rw-r--r-- | Lib/test/string_tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index a6ea2f3..8d210b1 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -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) |