Seed the store with test data.
(self)
| 37 | Path(self.tmp.name).unlink(missing_ok=True) |
| 38 | |
| 39 | def _seed_data(self): |
| 40 | """Seed the store with test data.""" |
| 41 | # File nodes |
| 42 | self.store.upsert_node(NodeInfo( |
| 43 | kind="File", name="/repo/auth.py", file_path="/repo/auth.py", |
| 44 | line_start=1, line_end=50, language="python", |
| 45 | )) |
| 46 | self.store.upsert_node(NodeInfo( |
| 47 | kind="File", name="/repo/main.py", file_path="/repo/main.py", |
| 48 | line_start=1, line_end=30, language="python", |
| 49 | )) |
| 50 | # Class |
| 51 | self.store.upsert_node(NodeInfo( |
| 52 | kind="Class", name="AuthService", file_path="/repo/auth.py", |
| 53 | line_start=5, line_end=40, language="python", |
| 54 | )) |
| 55 | # Functions |
| 56 | self.store.upsert_node(NodeInfo( |
| 57 | kind="Function", name="login", file_path="/repo/auth.py", |
| 58 | line_start=10, line_end=20, language="python", |
| 59 | parent_name="AuthService", |
| 60 | )) |
| 61 | self.store.upsert_node(NodeInfo( |
| 62 | kind="Function", name="process", file_path="/repo/main.py", |
| 63 | line_start=5, line_end=15, language="python", |
| 64 | )) |
| 65 | # Test |
| 66 | self.store.upsert_node(NodeInfo( |
| 67 | kind="Test", name="test_login", file_path="/repo/test_auth.py", |
| 68 | line_start=1, line_end=10, language="python", is_test=True, |
| 69 | )) |
| 70 | |
| 71 | # Edges |
| 72 | self.store.upsert_edge(EdgeInfo( |
| 73 | kind="CONTAINS", source="/repo/auth.py", |
| 74 | target="/repo/auth.py::AuthService", file_path="/repo/auth.py", |
| 75 | )) |
| 76 | self.store.upsert_edge(EdgeInfo( |
| 77 | kind="CONTAINS", source="/repo/auth.py::AuthService", |
| 78 | target="/repo/auth.py::AuthService.login", file_path="/repo/auth.py", |
| 79 | )) |
| 80 | self.store.upsert_edge(EdgeInfo( |
| 81 | kind="CALLS", source="/repo/main.py::process", |
| 82 | target="/repo/auth.py::AuthService.login", file_path="/repo/main.py", line=10, |
| 83 | )) |
| 84 | self.store.commit() |
| 85 | |
| 86 | def test_search_nodes(self): |
| 87 | # Direct call to store (tools need repo_root, which is harder to mock) |
no test coverage detected