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

Class MatcherAdapter

src/_pytest/mark/expression.py:174–187  ·  view source on GitHub ↗

Adapts a matcher function to a locals mapping as required by eval().

Source from the content-addressed store, hash-verified

172
173
174class MatcherAdapter(Mapping[str, bool]):
175 """Adapts a matcher function to a locals mapping as required by eval()."""
176
177 def __init__(self, matcher: Callable[[str], bool]) -> None:
178 self.matcher = matcher
179
180 def __getitem__(self, key: str) -> bool:
181 return self.matcher(key[len(IDENT_PREFIX) :])
182
183 def __iter__(self) -> Iterator[str]:
184 raise NotImplementedError()
185
186 def __len__(self) -> int:
187 raise NotImplementedError()
188
189
190class Expression:

Callers 1

evaluateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected