MCPcopy Create free account
hub / github.com/LLMQuant/quant-mind / _make_tree

Function _make_tree

tests/knowledge/test_tree.py:26–81  ·  view source on GitHub ↗

Three-level tree: root ├── a │ ├── a1 │ └── a2 └── b

()

Source from the content-addressed store, hash-verified

24
25
26def _make_tree() -> _SampleTree:
27 """Three-level tree:
28
29 root
30 ├── a
31 │ ├── a1
32 │ └── a2
33 └── b
34 """
35 a1_id, a2_id = uuid4(), uuid4()
36 a_id = uuid4()
37 b_id = uuid4()
38 root_id = uuid4()
39 a1 = TreeNode(
40 node_id=a1_id,
41 parent_id=a_id,
42 position=0,
43 title="A1",
44 summary="leaf a1",
45 )
46 a2 = TreeNode(
47 node_id=a2_id,
48 parent_id=a_id,
49 position=1,
50 title="A2",
51 summary="leaf a2",
52 )
53 a = TreeNode(
54 node_id=a_id,
55 parent_id=root_id,
56 position=0,
57 title="A",
58 summary="branch a",
59 children_ids=[a1_id, a2_id],
60 )
61 b = TreeNode(
62 node_id=b_id,
63 parent_id=root_id,
64 position=1,
65 title="B",
66 summary="leaf b",
67 )
68 root = TreeNode(
69 node_id=root_id,
70 parent_id=None,
71 position=0,
72 title="Root",
73 summary="root summary",
74 children_ids=[a_id, b_id],
75 )
76 return _SampleTree(
77 as_of=_now(),
78 source=_src(),
79 root_node_id=root_id,
80 nodes={n.node_id: n for n in [root, a, b, a1, a2]},
81 )
82
83

Callers 7

test_root_helperMethod · 0.85
test_children_ofMethod · 0.85
test_walk_dfs_orderMethod · 0.85
test_find_path_rootMethod · 0.85
test_find_path_leafMethod · 0.85

Calls 4

TreeNodeClass · 0.90
_SampleTreeClass · 0.85
_nowFunction · 0.70
_srcFunction · 0.70

Tested by

no test coverage detected