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

Method explanation_param

src/_pytest/assertion/rewrite.py:794–804  ·  view source on GitHub ↗

Return a new named %-formatting placeholder for expr. This creates a %-formatting placeholder for expr in the current formatting context, e.g. ``%(py0)s``. The placeholder and expr are placed in the current format context so that it can be used on the next call to .

(self, expr: ast.expr)

Source from the content-addressed store, hash-verified

792 return ast.Attribute(builtin_name, name, ast.Load())
793
794 def explanation_param(self, expr: ast.expr) -> str:
795 """Return a new named %-formatting placeholder for expr.
796
797 This creates a %-formatting placeholder for expr in the
798 current formatting context, e.g. ``%(py0)s``. The placeholder
799 and expr are placed in the current format context so that it
800 can be used on the next call to .pop_format_context().
801 """
802 specifier = "py" + str(next(self.variable_counter))
803 self.explanation_specifiers[specifier] = expr
804 return "%(" + specifier + ")s"
805
806 def push_format_context(self) -> None:
807 """Create a new formatting context.

Callers 7

generic_visitMethod · 0.95
visit_NamedExprMethod · 0.95
visit_NameMethod · 0.95
visit_BoolOpMethod · 0.95
visit_CallMethod · 0.95
visit_AttributeMethod · 0.95
visit_CompareMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected