MCPcopy Index your code
hub / github.com/python/cpython / test_sizeof

Method test_sizeof

Lib/test/test_io/test_memoryio.py:870–876  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

868
869 @support.cpython_only
870 def test_sizeof(self):
871 basesize = support.calcobjsize('P2n2Pn')
872 check = self.check_sizeof
873 self.assertEqual(object.__sizeof__(io.BytesIO()), basesize)
874 check(io.BytesIO(), basesize )
875 n = 1000 # use a variable to prevent constant folding
876 check(io.BytesIO(b'a' * n), basesize + sys.getsizeof(b'a' * n))
877
878 # Various tests of copy-on-write behaviour for BytesIO.
879

Callers

nothing calls this directly

Calls 3

checkFunction · 0.50
assertEqualMethod · 0.45
__sizeof__Method · 0.45

Tested by

no test coverage detected