From: Antoine Pitrou Date: Wed, 13 Jan 2010 15:02:13 +0000 (+0000) Subject: Issue #7625: Add more tests that bytearray methods return new objects, X-Git-Tag: v2.7a3~166 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f76d132a56a92f1911e16afb59443d5b44f8d32;p=python Issue #7625: Add more tests that bytearray methods return new objects, even if identical. Patch by Florent Xicluna (again). --- diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index 6988bdbd7b..f2c9aa3915 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):