MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / td_snippet

Function td_snippet

test/doc-examples/mzcompose.py:157–183  ·  view source on GitHub ↗
(file: pathlib.Path)

Source from the content-addressed store, hash-verified

155
156
157def td_snippet(file: pathlib.Path) -> str:
158 with open(file) as f:
159 examples = yaml.load(f, Loader=yaml.Loader)
160 snippet: list[str] = []
161 for example in examples:
162 if "test_depends_on" in example:
163 snippet.append(td_snippet(LOCATION / example["test_depends_on"]))
164 if (
165 not "code" in example
166 or not example.get("testable", True)
167 or "syntax" in example.get("name", "")
168 ):
169 continue
170 if "test_setup" in example:
171 snippet.append(example["test_setup"])
172 snippet.extend(
173 td_query(
174 example["code"],
175 (
176 (example.get("test_results") or example.get("results"))
177 if example.get("testable_results", True)
178 else None
179 ),
180 example.get("test_replacements", {}),
181 )
182 )
183 return "\n".join(snippet).strip()
184
185
186def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:

Callers 1

processFunction · 0.85

Calls 6

td_queryFunction · 0.85
loadMethod · 0.45
appendMethod · 0.45
getMethod · 0.45
extendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected