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

Method evaluate

src/_pytest/mark/expression.py:340–353  ·  view source on GitHub ↗

Evaluate the match expression. :param matcher: A callback which determines whether an identifier matches or not. See the :class:`ExpressionMatcher` protocol for details and example. :returns: Whether the expression matches or not. :raises UsageError

(self, matcher: ExpressionMatcher)

Source from the content-addressed store, hash-verified

338 return Expression(input, code)
339
340 def evaluate(self, matcher: ExpressionMatcher) -> bool:
341 """Evaluate the match expression.
342
343 :param matcher:
344 A callback which determines whether an identifier matches or not.
345 See the :class:`ExpressionMatcher` protocol for details and example.
346
347 :returns: Whether the expression matches or not.
348
349 :raises UsageError:
350 If the matcher doesn't support the expression. Cannot happen if the
351 matcher supports all expressions.
352 """
353 return bool(eval(self._code, {"__builtins__": {}}, MatcherAdapter(matcher)))

Callers 3

deselect_by_keywordFunction · 0.80
deselect_by_markFunction · 0.80
evaluateFunction · 0.80

Calls 1

MatcherAdapterClass · 0.85

Tested by 1

evaluateFunction · 0.64