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 | 8f328d0c1d86096b3d4e5f1c1ac497663e197a0d (patch) | |
tree | 8673cc00da383533b00baf893913062390c7d95f /Lib/test/test_memoryio.py | |
parent | 10f0c50a0bc9237d640cb7beb216d63f9ec2b3eb (diff) | |
download | cpython-8f328d0c1d86096b3d4e5f1c1ac497663e197a0d.zip cpython-8f328d0c1d86096b3d4e5f1c1ac497663e197a0d.tar.gz cpython-8f328d0c1d86096b3d4e5f1c1ac497663e197a0d.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 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 |