MCPcopy
hub / github.com/pytest-dev/pytest / compile

Method compile

src/_pytest/mark/expression.py:325–338  ·  view source on GitHub ↗

Compile a match expression. :param input: The input expression - one line. :raises SyntaxError: If the expression is malformed.

(cls, input: str)

Source from the content-addressed store, hash-verified

323
324 @classmethod
325 def compile(cls, input: str) -> Expression:
326 """Compile a match expression.
327
328 :param input: The input expression - one line.
329
330 :raises SyntaxError: If the expression is malformed.
331 """
332 astexpr = expression(Scanner(input))
333 code = compile(
334 astexpr,
335 filename="<pytest match expression>",
336 mode="eval",
337 )
338 return Expression(input, code)
339
340 def evaluate(self, matcher: ExpressionMatcher) -> bool:
341 """Evaluate the match expression.

Callers 15

raises.pyFile · 0.80
__init__Method · 0.80
logging.pyFile · 0.80
pytester.pyFile · 0.80
monkeypatch.pyFile · 0.80
_parse_expressionFunction · 0.80
parse_warning_filterFunction · 0.80
test_read_pycMethod · 0.80

Calls 3

expressionFunction · 0.85
ScannerClass · 0.85
ExpressionClass · 0.85

Tested by 8

test_read_pycMethod · 0.64
evaluateFunction · 0.64
test_raisesexc_tostringFunction · 0.64