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

Method eval

src/_pytest/_code/code.py:164–173  ·  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

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

Callers

nothing calls this directly

Calls 2

copyMethod · 0.80
updateMethod · 0.80

Tested by

no test coverage detected