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

Method eval

src/_pytest/_code/code.py:161–170  ·  view source on GitHub ↗

Evaluate 'code' in the frame. 'vars' are optional additional local variables. Returns the result of the evaluation.

(self, code, **vars)

Source from the content-addressed store, hash-verified

159 return self.code.fullsource.getstatement(self.lineno)
160
161 def eval(self, code, **vars):
162 """Evaluate 'code' in the frame.
163
164 'vars' are optional additional local variables.
165
166 Returns the result of the evaluation.
167 """
168 f_locals = self.f_locals.copy()
169 f_locals.update(vars)
170 return eval(code, self.f_globals, f_locals)
171
172 def repr(self, object: object) -> str:
173 """Return a 'safe' (non-recursive, one-line) string repr for 'object'."""

Callers

nothing calls this directly

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected