Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_array.py @ 55115:a76b34cfc897
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
| author | Alexandre Vassalotti <alexandre@peadrop.com> |
|---|---|
| date | Sun, 05 Jul 2009 06:25:14 +0000 |
| parents | ab434f0dcb15 |
| children | 7bb7758e6d64 |
line wrap: on
line diff
--- a/Lib/test/test_array.py Sun Jul 05 05:47:28 2009 +0000 +++ b/Lib/test/test_array.py Sun Jul 05 06:25:14 2009 +0000 @@ -272,6 +272,12 @@ 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 @@ 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)
