Mercurial > cpython-lru_cache-weakref
diff Lib/test/string_tests.py @ 39302:041eb6231cdc legacy-trunk
Bug #1515471: string.replace() accepts character buffers again.
Pass the char* and size around rather than PyObject's.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Sun, 30 Jul 2006 06:57:04 +0000 |
| parents | 67450db26f81 |
| children | cfb77fff0240 |
line wrap: on
line diff
--- a/Lib/test/string_tests.py Sun Jul 30 06:55:48 2006 +0000 +++ b/Lib/test/string_tests.py Sun Jul 30 06:57:04 2006 +0000 @@ -147,8 +147,8 @@ 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 @@ 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', '!', '')
