_resolve_chunk returns the correct chunk and handles boundary and miss cases.
()
| 49 | |
| 50 | |
| 51 | def 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( |
nothing calls this directly
no test coverage detected