Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

test(python): local classes are extracted defs now (#1548)

Martin Vogeld4beec3c5811
diff --git a/tests/test_py_lsp.c b/tests/test_py_lsp.c
index 3ee2d8ad5..7a1c460d5 100644
--- a/tests/test_py_lsp.c
+++ b/tests/test_py_lsp.c
@@ -3629,12 +3629,16 @@ TEST(pylsp_nested_and_local_classbody_calls_join_extracted_caller) {
{"field(35)", "test.main.Controller.build", "test.main.field"},
};
CBMFileResult *r = extract_py(source);
- bool correct = pylsp_class_sites(r, source, sites, 7) &&
- !pylsp_module_has_def(r, "test.main.build.Local") &&
- !pylsp_module_has_def(r, "test.main.Controller.build.Local");
+ /* #1548: a class declared in a function body is extracted, as a local of
+ * that function; its class-body calls still join the enclosing function
+ * (the sites above), never the local class. */
+ bool sites_ok = pylsp_class_sites(r, source, sites, 7);
+ bool locals_extracted = r && pylsp_module_has_def(r, "test.main.build.Local") &&
+ pylsp_module_has_def(r, "test.main.Controller.build.Local");
if (r)
cbm_free_result(r);
- ASSERT_TRUE(correct);
+ ASSERT_TRUE(sites_ok);
+ ASSERT_TRUE(locals_extracted);
PASS();
}