MCPcopy
hub / github.com/MinishLab/semble / test_resolve_chunk

Function test_resolve_chunk

tests/test_mcp.py:51–66  ·  view source on GitHub ↗

_resolve_chunk returns the correct chunk and handles boundary and miss cases.

()

Source from the content-addressed store, hash-verified

49
50
51def test_resolve_chunk() -> None:
52 """_resolve_chunk returns the correct chunk and handles boundary and miss cases."""
53 interior = make_chunk("line1\nline2\nline3", "src/a.py") # start=1, end=3
54 boundary = make_chunk("last line", "src/a.py") # start=1, end=1 (single-line)
55
56 # Line strictly inside a multi-line chunk hits the early-return path.
57 assert resolve_chunk([interior], "src/a.py", 2) is interior
58
59 # Line equal to end_line of a single-line chunk hits the fallback path.
60 assert resolve_chunk([boundary], "src/a.py", 1) is boundary
61
62 # Unknown file returns None.
63 assert resolve_chunk([interior], "src/other.py", 1) is None
64
65 # Line out of range returns None.
66 assert resolve_chunk([interior], "src/a.py", 99) is None
67
68
69@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 2

make_chunkFunction · 0.90
resolve_chunkFunction · 0.90

Tested by

no test coverage detected