diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-07-30 06:57:04 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-07-30 06:57:04 (GMT) |
commit | f71ec5a0acbf606abd8a19519829db8de20352ec (patch) | |
tree | 96c623754aeab36ea5f15a2c0ca75ce9682eeb5e /Lib | |
parent | 07aadb14f39c585a463f19ec0496860a100051ad (diff) | |
download | cpython-f71ec5a0acbf606abd8a19519829db8de20352ec.zip cpython-f71ec5a0acbf606abd8a19519829db8de20352ec.tar.gz cpython-f71ec5a0acbf606abd8a19519829db8de20352ec.tar.bz2 |
Bug #1515471: string.replace() accepts character buffers again.
Pass the char* and size around rather than PyObject's.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/string_tests.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index 236c529..73447ad 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -147,8 +147,8 @@ class CommonTest(unittest.TestCase): else: r2, rem = len(i)+1, 0 if rem or r1 != r2: - self.assertEqual(rem, 0) - self.assertEqual(r1, r2) + self.assertEqual(rem, 0, '%s != 0 for %s' % (rem, i)) + self.assertEqual(r1, r2, '%s != %s for %s' % (r1, r2, i)) def test_find(self): self.checkequal(0, 'abcdefghiabc', 'find', 'abc') @@ -636,6 +636,11 @@ class CommonTest(unittest.TestCase): EQ("bobobXbobob", "bobobobXbobobob", "replace", "bobob", "bob") EQ("BOBOBOB", "BOBOBOB", "replace", "bob", "bobby") + ba = buffer('a') + bb = buffer('b') + EQ("bbc", "abc", "replace", ba, bb) + EQ("aac", "abc", "replace", bb, ba) + # self.checkequal('one@two!three!', 'one!two!three!', 'replace', '!', '@', 1) self.checkequal('onetwothree', 'one!two!three!', 'replace', '!', '') |