summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-07-29 22:01:44 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-07-29 22:01:44 (GMT)
commit57911f6c1a84dd0eb050908f81d6e60d38054271 (patch)
tree539f04bf5b1110f16170097d74467cfd188aa3bd /Lib
parenta264384fe6de357680ca0cf02cd6024bbba0ba45 (diff)
parent8f328d0c1d86096b3d4e5f1c1ac497663e197a0d (diff)
downloadcpython-57911f6c1a84dd0eb050908f81d6e60d38054271.zip
cpython-57911f6c1a84dd0eb050908f81d6e60d38054271.tar.gz
cpython-57911f6c1a84dd0eb050908f81d6e60d38054271.tar.bz2
Issue #15489: Add a __sizeof__ implementation for BytesIO objects.
Patch by Serhiy Storchaka.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_memoryio.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py
index 49ca44f..9248098 100644
--- a/Lib/test/test_memoryio.py
+++ b/Lib/test/test_memoryio.py
@@ -654,6 +654,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('P2PP2PP')
+ 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