MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / python_init_local_inheritance

Function python_init_local_inheritance

tests/test_pipeline.c:13024–13055  ·  view source on GitHub ↗

Python file identity keeps .__init__; its exported symbols do not. */

Source from the content-addressed store, hash-verified

13022
13023/* Python file identity keeps .__init__; its exported symbols do not. */
13024static bool python_init_local_inheritance(cbm_store_t *store, const char *project,
13025 const char *module) {
13026 char child_qn[768], parent_qn[768], wrong_qn[768];
13027 int cn = snprintf(child_qn, sizeof(child_qn), "%s.%s.BooleanField", project, module);
13028 int pn = snprintf(parent_qn, sizeof(parent_qn), "%s.%s.Field", project, module);
13029 int wn = snprintf(wrong_qn, sizeof(wrong_qn), "%s.other.Field", project);
13030 if (cn <= 0 || (size_t)cn >= sizeof(child_qn) || pn <= 0 || (size_t)pn >= sizeof(parent_qn) ||
13031 wn <= 0 || (size_t)wn >= sizeof(wrong_qn))
13032 return false;
13033 cbm_node_t child = {0}, parent = {0}, wrong = {0};
13034 bool ok = cbm_store_find_node_by_qn(store, project, child_qn, &child) == CBM_STORE_OK &&
13035 cbm_store_find_node_by_qn(store, project, parent_qn, &parent) == CBM_STORE_OK &&
13036 cbm_store_find_node_by_qn(store, project, wrong_qn, &wrong) == CBM_STORE_OK &&
13037 child.id > 0 && parent.id > 0 && wrong.id > 0 && parent.id != wrong.id &&
13038 child.label && parent.label && wrong.label && strcmp(child.label, "Class") == 0 &&
13039 strcmp(parent.label, "Class") == 0 && strcmp(wrong.label, "Class") == 0;
13040 cbm_edge_t *edges = NULL;
13041 int count = 0, local = 0, foreign = 0;
13042 if (ok) {
13043 ok = cbm_store_find_edges_by_source_type(store, child.id, "INHERITS", &edges, &count) ==
13044 CBM_STORE_OK;
13045 for (int i = 0; ok && i < count; i++) {
13046 local += edges[i].target_id == parent.id;
13047 foreign += edges[i].target_id == wrong.id;
13048 }
13049 }
13050 cbm_store_free_edges(edges, count);
13051 cbm_node_free_fields(&child);
13052 cbm_node_free_fields(&parent);
13053 cbm_node_free_fields(&wrong);
13054 return ok && local == 1 && foreign == 0;
13055}
13056
13057static int python_init_scope_pipeline_case(bool parallel, const char *failure_stage) {
13058 static const char body[] = "from util import normalize\n"

Callers 1

Calls 4

cbm_store_free_edgesFunction · 0.85
cbm_node_free_fieldsFunction · 0.85

Tested by

no test coverage detected