MCPcopy Create free account
hub / github.com/ScalingIntelligence/tokasaurus / test_basic_allocation

Function test_basic_allocation

tests/test_block_allocator.py:16–38  ·  view source on GitHub ↗
(allocator: BlockAllocator)

Source from the content-addressed store, hash-verified

14
15
16def test_basic_allocation(allocator: BlockAllocator):
17 allocator.sanity_checks()
18
19 input_ids1 = [1] * 16
20 input_ids2 = [2] * 9
21 input_ids3 = [3] * 8
22
23 allocator.sanity_checks()
24
25 kvs1, num_cached1 = allocator.allocate_with_prefix_match("seq1", input_ids1)
26 allocator.sanity_checks()
27
28 assert num_cached1 == 0
29 assert len(kvs1) == math.ceil(len(input_ids1) / PAGE_SIZE)
30
31 kvs2, num_cached2 = allocator.allocate_with_prefix_match("seq2", input_ids2)
32 allocator.sanity_checks()
33
34 assert num_cached2 == 0
35 assert len(kvs2) == math.ceil(len(input_ids2) / PAGE_SIZE)
36
37 with pytest.raises(NoSpaceException):
38 allocator.allocate_with_prefix_match("seq3", input_ids3)
39
40
41def test_basic_caching(allocator: BlockAllocator):

Callers

nothing calls this directly

Calls 2

sanity_checksMethod · 0.80

Tested by

no test coverage detected