MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_alloc

Method test_alloc

Lib/test/test_bytes.py:1598–1608  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1596 # self.assertGreaterEqual since, in RustPython, the underlying storage
1597 # is a Vec which doesn't require trailing null byte.
1598 def test_alloc(self):
1599 b = bytearray()
1600 alloc = b.__alloc__()
1601 self.assertGreaterEqual(alloc, 0)
1602 seq = [alloc]
1603 for i in range(100):
1604 b += b"x"
1605 alloc = b.__alloc__()
1606 self.assertGreaterEqual(alloc, len(b)) # NOTE: RUSTPYTHON patched
1607 if alloc not in seq:
1608 seq.append(alloc)
1609
1610 # NOTE: RUSTPYTHON:
1611 #

Callers

nothing calls this directly

Calls 4

lenFunction · 0.85
__alloc__Method · 0.80
assertGreaterEqualMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected