From e503cf9b0e74ec76fce8c021f0c73aa75c4cb6f4 Mon Sep 17 00:00:00 2001 From: Alexandre Vassalotti Date: Sun, 5 Jul 2009 06:25:14 +0000 Subject: Fix array.extend and array.__iadd__ to handle the case where an array is extended with itself. This bug is specific the py3k version of arraymodule.c --- Lib/test/test_array.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Lib/test/test_array.py') diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 79e11999596..3dd4f6df3b5 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -272,6 +272,12 @@ class BaseTest(unittest.TestCase): a, array.array(self.typecode, self.example[::-1]+2*self.example) ) + a = array.array(self.typecode, self.example) + a += a + self.assertEqual( + a, + array.array(self.typecode, self.example + self.example) + ) b = array.array(self.badtypecode()) self.assertRaises(TypeError, a.__add__, b) @@ -667,6 +673,13 @@ class BaseTest(unittest.TestCase): array.array(self.typecode, self.example+self.example[::-1]) ) + a = array.array(self.typecode, self.example) + a.extend(a) + self.assertEqual( + a, + array.array(self.typecode, self.example+self.example) + ) + b = array.array(self.badtypecode()) self.assertRaises(TypeError, a.extend, b) -- cgit v1.2.3