MCPcopy
hub / github.com/tirth8205/code-review-graph / _is_test_function

Function _is_test_function

code_review_graph/parser.py:773–785  ·  view source on GitHub ↗

A function is a test if its name matches test patterns, it lives in a test file and has a test-runner name, or it has a @Test annotation.

(
    name: str, file_path: str, decorators: tuple[str, ...] = (),
)

Source from the content-addressed store, hash-verified

771
772
773def _is_test_function(
774 name: str, file_path: str, decorators: tuple[str, ...] = (),
775) -> bool:
776 """A function is a test if its name matches test patterns, it lives
777 in a test file and has a test-runner name, or it has a @Test annotation.
778 """
779 if any(p.search(name) for p in _TEST_PATTERNS):
780 return True
781 if _is_test_file(file_path) and name in _TEST_RUNNER_NAMES:
782 return True
783 if decorators and any(d in _TEST_ANNOTATIONS for d in decorators):
784 return True
785 return False
786
787
788def file_hash(path: Path) -> str:

Calls 2

searchMethod · 0.80
_is_test_fileFunction · 0.70

Tested by

no test coverage detected