diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-13 15:02:13 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-13 15:02:13 (GMT) |
commit | 5f76d132a56a92f1911e16afb59443d5b44f8d32 (patch) | |
tree | e25a684027deccfc9c2dd3f50544dbfb43827fd9 /Lib/test/test_bytes.py | |
parent | f58021f7c3398fa2b6e9d9af5365d9aec20e9054 (diff) | |
download | cpython-5f76d132a56a92f1911e16afb59443d5b44f8d32.zip cpython-5f76d132a56a92f1911e16afb59443d5b44f8d32.tar.gz cpython-5f76d132a56a92f1911e16afb59443d5b44f8d32.tar.bz2 |
Issue #7625: Add more tests that bytearray methods return new objects,
even if identical. Patch by Florent Xicluna (again).
Diffstat (limited to 'Lib/test/test_bytes.py')
-rw-r--r-- | Lib/test/test_bytes.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index 6988bdb..f2c9aa3 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -922,7 +922,13 @@ class BytearrayPEP3137Test(unittest.TestCase, self.assertEqual(val, newval) self.assertTrue(val is not newval, methname+' returned self on a mutable object') - + for expr in ('val.split()[0]', 'val.rsplit()[0]', + 'val.partition(".")[0]', 'val.rpartition(".")[2]', + 'val.splitlines()[0]', 'val.replace("", "")'): + newval = eval(expr) + self.assertEqual(val, newval) + self.assertTrue(val is not newval, + expr+' returned val on a mutable object') class FixedStringTest(test.string_tests.BaseTest): |