MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / _print_tree_structure

Function _print_tree_structure

python/tests/test_invariant_bug.py:42–53  ·  view source on GitHub ↗

Print tree structure to see actual layout

(node, level)

Source from the content-addressed store, hash-verified

40
41
42def _print_tree_structure(node, level):
43 """Print tree structure to see actual layout"""
44 indent = " " * level
45 if node.is_leaf():
46 print(f"{indent}Leaf: {len(node.keys)} keys = {node.keys}")
47 else:
48 print(f"{indent}Branch: {len(node.keys)} keys, {len(node.children)} children")
49 if len(node.children) == 1:
50 print(f"{indent}*** SINGLE CHILD DETECTED ***")
51 for i, child in enumerate(node.children):
52 print(f"{indent}Child {i}:")
53 _print_tree_structure(child, level + 1)
54
55
56if __name__ == "__main__":

Calls 1

is_leafMethod · 0.45

Tested by

no test coverage detected