mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Issue #7625: Add more tests that bytearray methods return new objects,
even if identical. Patch by Florent Xicluna (again).
This commit is contained in:
parent
f58021f7c3
commit
5f76d132a5
1 changed files with 7 additions and 1 deletions
|
@ -922,7 +922,13 @@ class BytearrayPEP3137Test(unittest.TestCase,
|
||||||
self.assertEqual(val, newval)
|
self.assertEqual(val, newval)
|
||||||
self.assertTrue(val is not newval,
|
self.assertTrue(val is not newval,
|
||||||
methname+' returned self on a mutable object')
|
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):
|
class FixedStringTest(test.string_tests.BaseTest):
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue