MCPcopy Index your code
hub / github.com/tirth8205/code-review-graph / _get_test_description

Method _get_test_description

code_review_graph/parser.py:2205–2217  ·  view source on GitHub ↗

Extract the first string argument from a test runner call node.

(self, call_node, source: bytes)

Source from the content-addressed store, hash-verified

2203 _MAX_TEST_DESCRIPTION_LEN = 200 # Cap test description length in node names
2204
2205 def _get_test_description(self, call_node, source: bytes) -> Optional[str]:
2206 """Extract the first string argument from a test runner call node."""
2207 for child in call_node.children:
2208 if child.type == "arguments":
2209 for arg in child.children:
2210 if arg.type in ("string", "template_string"):
2211 raw = arg.text.decode("utf-8", errors="replace")
2212 stripped = raw.strip("'\"`")
2213 normalized = re.sub(r"\s+", " ", stripped).strip()
2214 if len(normalized) > self._MAX_TEST_DESCRIPTION_LEN:
2215 normalized = normalized[: self._MAX_TEST_DESCRIPTION_LEN]
2216 return normalized
2217 return None
2218
2219 def _extract_from_tree(
2220 self,

Callers 1

_extract_callsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected