Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cbaa625

Browse files
committed
Merged revisions 77475 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r77475 | antoine.pitrou | 2010-01-13 16:02:13 +0100 (mer., 13 janv. 2010) | 4 lines Issue #7625: Add more tests that bytearray methods return new objects, even if identical. Patch by Florent Xicluna (again). ........
1 parent 8e33fd7 commit cbaa625

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Lib/test/test_bytes.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,13 @@ def test_returns_new_copy(self):
972972
self.assertEqual(val, newval)
973973
self.assertTrue(val is not newval,
974974
methname+' returned self on a mutable object')
975-
975+
for expr in ('val.split()[0]', 'val.rsplit()[0]',
976+
'val.partition(b".")[0]', 'val.rpartition(b".")[2]',
977+
'val.splitlines()[0]', 'val.replace(b"", b"")'):
978+
newval = eval(expr)
979+
self.assertEqual(val, newval)
980+
self.assertTrue(val is not newval,
981+
expr+' returned val on a mutable object')
976982

977983
class FixedStringTest(test.string_tests.BaseTest):
978984

0 commit comments

Comments
 (0)