summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMeador Inge <meadori@gmail.com>2012-08-11 03:35:45 (GMT)
committerMeador Inge <meadori@gmail.com>2012-08-11 03:35:45 (GMT)
commit03b4d5072aa044d8c6827e387b647dcc6c9d0ff6 (patch)
tree3921b2fba6e6e96ecf6a848296cc2e15190f669b /Lib
parent7dbee38564cb4112da59a4b8aa2e1759f09bb1f8 (diff)
downloadcpython-03b4d5072aa044d8c6827e387b647dcc6c9d0ff6.zip
cpython-03b4d5072aa044d8c6827e387b647dcc6c9d0ff6.tar.gz
cpython-03b4d5072aa044d8c6827e387b647dcc6c9d0ff6.tar.bz2
Issue #15424: Add a __sizeof__ implementation for array objects.
Patch by Ludwig Hähne.
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/test/test_array.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index 5190c35..e26e9ad 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):