From 03b4d5072aa044d8c6827e387b647dcc6c9d0ff6 Mon Sep 17 00:00:00 2001 From: Meador Inge Date: Fri, 10 Aug 2012 22:35:45 -0500 Subject: Issue #15424: Add a __sizeof__ implementation for array objects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Ludwig Hähne. --- 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 5190c357ea..e26e9add05 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -988,6 +988,19 @@ class BaseTest(unittest.TestCase): a = array.array('H', b"1234") self.assertEqual(len(a) * a.itemsize, 4) + @support.cpython_only + def test_sizeof_with_buffer(self): + a = array.array(self.typecode, self.example) + basesize = support.calcvobjsize('4Pi') + buffer_size = a.buffer_info()[1] * a.itemsize + support.check_sizeof(self, a, basesize + buffer_size) + + @support.cpython_only + def test_sizeof_without_buffer(self): + a = array.array(self.typecode) + basesize = support.calcvobjsize('4Pi') + support.check_sizeof(self, a, basesize) + class StringTest(BaseTest): -- cgit v1.2.1