Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_array.py @ 78492:91382d4e2dfb 2.7
Issue #15424: Add a __sizeof__ implementation for array objects.
Patch by Ludwig Hähne.
| author | Meador Inge <meadori@gmail.com> |
|---|---|
| date | Fri, 10 Aug 2012 22:05:45 -0500 |
| parents | 7bfedb159e82 |
| children | 2d330f7908e7 |
line wrap: on
line diff
--- a/Lib/test/test_array.py Thu Aug 09 23:04:42 2012 -0500 +++ b/Lib/test/test_array.py Fri Aug 10 22:05:45 2012 -0500 @@ -985,6 +985,19 @@ 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'
