summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_array.py
diff options
context:
space:
mode:
authorMeador Inge <meadori@gmail.com>2012-08-11 03:05:45 (GMT)
committerMeador Inge <meadori@gmail.com>2012-08-11 03:05:45 (GMT)
commit2d639d5665739886e2044b2c92d2e157ee0161aa (patch)
tree03cdede58fde2e1cb18a7f6634b8ae4c8097bfe2 /Lib/test/test_array.py
parenta939105a4018398aa21ee152283e3db5c7acd662 (diff)
downloadcpython-2d639d5665739886e2044b2c92d2e157ee0161aa.zip
cpython-2d639d5665739886e2044b2c92d2e157ee0161aa.tar.gz
cpython-2d639d5665739886e2044b2c92d2e157ee0161aa.tar.bz2
Issue #15424: Add a __sizeof__ implementation for array objects.
Patch by Ludwig Hähne.
Diffstat (limited to 'Lib/test/test_array.py')
-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 acf5b8f..74dccbf 100755
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -985,6 +985,19 @@ class UnsignedNumberTest(NumberTest):
upper = long(pow(2, a.itemsize * 8)) - 1L
self.check_overflow(lower, upper)
+ @test_support.cpython_only
+ def test_sizeof_with_buffer(self):
+ a = array.array(self.typecode, self.example)
+ basesize = test_support.calcvobjsize('4P')
+ buffer_size = a.buffer_info()[1] * a.itemsize
+ test_support.check_sizeof(self, a, basesize + buffer_size)
+
+ @test_support.cpython_only
+ def test_sizeof_without_buffer(self):
+ a = array.array(self.typecode)
+ basesize = test_support.calcvobjsize('4P')
+ test_support.check_sizeof(self, a, basesize)
+
class ByteTest(SignedNumberTest):
typecode = 'b'