diff options
| author | Antoine Pitrou <solipsis@pitrou.net> | 2012-07-29 22:01:06 (GMT) |
|---|---|---|
| committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-07-29 22:01:06 (GMT) |
| commit | baee34c3442592785171abce5560ae2b618c5645 (patch) | |
| tree | 1b42115bf6527a5c077b9ef23a25c98b03b4c585 /Lib/test/test_memoryio.py | |
| parent | bff5df0d1ca6c37a3454dd5dff5d587af27ab8be (diff) | |
| download | cpython-baee34c3442592785171abce5560ae2b618c5645.zip cpython-baee34c3442592785171abce5560ae2b618c5645.tar.gz cpython-baee34c3442592785171abce5560ae2b618c5645.tar.bz2 | |
Issue #15489: Add a __sizeof__ implementation for BytesIO objects.
Patch by Serhiy Storchaka.
Diffstat (limited to 'Lib/test/test_memoryio.py')
| -rw-r--r-- | Lib/test/test_memoryio.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py index 68657aa..007a092 100644 --- a/Lib/test/test_memoryio.py +++ b/Lib/test/test_memoryio.py @@ -638,6 +638,17 @@ class CBytesIOTest(PyBytesIOTest): memio.close() self.assertRaises(ValueError, memio.__setstate__, (b"closed", 0, None)) + check_sizeof = support.check_sizeof + + @support.cpython_only + def test_sizeof(self): + basesize = support.calcobjsize(b'P2PP2P') + check = self.check_sizeof + self.assertEqual(object.__sizeof__(io.BytesIO()), basesize) + check(io.BytesIO(), basesize ) + check(io.BytesIO(b'a'), basesize + 1 + 1 ) + check(io.BytesIO(b'a' * 1000), basesize + 1000 + 1 ) + class CStringIOTest(PyStringIOTest): ioclass = io.StringIO |
