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

Method assign

src/_pytest/assertion/rewrite.py:774–778  ·  view source on GitHub ↗

Give *expr* a name.

(self, expr: ast.expr)

Source from the content-addressed store, hash-verified

772 return name
773
774 def assign(self, expr: ast.expr) -> ast.Name:
775 """Give *expr* a name."""
776 name = self.variable()
777 self.statements.append(ast.Assign([ast.Name(name, ast.Store())], expr))
778 return ast.Name(name, ast.Load())
779
780 def display(self, expr: ast.expr) -> ast.expr:
781 """Call saferepr on the expression."""

Callers 6

generic_visitMethod · 0.95
visit_BoolOpMethod · 0.95
visit_UnaryOpMethod · 0.95
visit_BinOpMethod · 0.95
visit_CallMethod · 0.95
visit_AttributeMethod · 0.95

Calls 2

variableMethod · 0.95
appendMethod · 0.80

Tested by

no test coverage detected