MCPcopy Create free account
hub / github.com/pytest-dev/pytest / compile

Method compile

src/_pytest/mark/expression.py:202–213  ·  view source on GitHub ↗

Compile a match expression. :param input: The input expression - one line.

(self, input: str)

Source from the content-addressed store, hash-verified

200
201 @classmethod
202 def compile(self, input: str) -> "Expression":
203 """Compile a match expression.
204
205 :param input: The input expression - one line.
206 """
207 astexpr = expression(Scanner(input))
208 code: types.CodeType = compile(
209 astexpr,
210 filename="<pytest match expression>",
211 mode="eval",
212 )
213 return Expression(code)
214
215 def evaluate(self, matcher: Callable[[str], bool]) -> bool:
216 """Evaluate the match expression.

Callers 14

__exit__Method · 0.80
logging.pyFile · 0.80
pytester.pyFile · 0.80
monkeypatch.pyFile · 0.80
_parse_expressionFunction · 0.80
parse_changelogFunction · 0.80
test_read_pycMethod · 0.80
evaluateFunction · 0.80
do_assertFunction · 0.80

Calls 3

expressionFunction · 0.85
ScannerClass · 0.85
ExpressionClass · 0.85

Tested by 5

test_read_pycMethod · 0.64
evaluateFunction · 0.64