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

Method explanation_param

src/_pytest/assertion/rewrite.py:795–805  ·  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

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

Callers 6

generic_visitMethod · 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