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

Method variable

src/_pytest/assertion/rewrite.py:766–771  ·  view source on GitHub ↗

Get a new variable.

(self)

Source from the content-addressed store, hash-verified

764 return "PYTEST_DONT_REWRITE" in docstring
765
766 def variable(self) -> str:
767 """Get a new variable."""
768 # Use a character invalid in python identifiers to avoid clashing.
769 name = "@py_assert" + str(next(self.variable_counter))
770 self.variables.append(name)
771 return name
772
773 def assign(self, expr: ast.expr) -> ast.Name:
774 """Give *expr* a name."""

Callers 3

assignMethod · 0.95
visit_BoolOpMethod · 0.95
visit_CompareMethod · 0.95

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected