[Python-checkins] r77475 - python/trunk/Lib/test/test_bytes.py

antoine.pitrou python-checkins at python.org
Wed Jan 13 16:02:14 CET 2010


Author: antoine.pitrou
Date: Wed Jan 13 16:02:13 2010
New Revision: 77475

Log:
Issue #7625: Add more tests that bytearray methods return new objects,
even if identical.  Patch by Florent Xicluna (again).



Modified:
   python/trunk/Lib/test/test_bytes.py

Modified: python/trunk/Lib/test/test_bytes.py
==============================================================================
--- python/trunk/Lib/test/test_bytes.py	(original)
+++ python/trunk/Lib/test/test_bytes.py	Wed Jan 13 16:02:13 2010
@@ -922,7 +922,13 @@
             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):
 


More information about the Python-checkins mailing list