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

Method eval

src/_pytest/_code/code.py:164–173  ·  src/_pytest/_code/code.py::Frame.eval

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 class="st">"""Evaluate &class="cm">#x27;code' in the frame.
166
167 &class="cm">#x27;vars' are optional additional local variables.
168
169 Returns the result of the evaluation.
170 class="st">"""
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 class="st">""class="st">"Return a &class="cm">#x27;safe' (non-recursive, one-line) string repr for 'object'."class="st">""

Callers

nothing calls this directly

Calls 2

copyMethod · 0.80
updateMethod · 0.80

Tested by

no test coverage detected