MCPcopy Create free account
hub / github.com/Qinbf/groundmap / test_nested_sections

Method test_nested_sections

scripts/tests/test_section_parser.py:114–129  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

112
113class TestBuildOutline:
114 def test_nested_sections(self):
115 text = "# H1\n\n## H2a\n\n### H3\n\n## H2b\n"
116 blocks = split_blocks(text)
117 # 给 heading 分配 anchor 让 outline 能识别
118 for i, b in enumerate(blocks):
119 if b.kind == "heading":
120 b.anchor = f"h-{b.level}-{i}-test{i:02d}"
121 outline = build_outline(blocks, len(text))
122 sections = outline["sections"]
123 assert len(sections) == 1 # 一个顶层 H1
124 h1 = sections[0]
125 assert h1.title == "H1"
126 assert len(h1.children) == 2 # H2a, H2b
127 assert h1.children[0].title == "H2a"
128 assert len(h1.children[0].children) == 1 # H3
129 assert h1.children[1].title == "H2b"
130
131 def test_find_section_by_anchor(self):
132 text = "# H1\n\n## H2\n"

Callers

nothing calls this directly

Calls 2

split_blocksFunction · 0.90
build_outlineFunction · 0.90

Tested by

no test coverage detected