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

Method visit_Attribute

src/_pytest/assertion/rewrite.py:1089–1099  ·  view source on GitHub ↗
(self, attr: ast.Attribute)

Source from the content-addressed store, hash-verified

1087 return new_starred, "*" + expl
1088
1089 def visit_Attribute(self, attr: ast.Attribute) -> tuple[ast.Name, str]:
1090 if not isinstance(attr.ctx, ast.Load):
1091 return self.generic_visit(attr)
1092 value, value_expl = self.visit(attr.value)
1093 res = self.assign(
1094 ast.copy_location(ast.Attribute(value, attr.attr, ast.Load()), attr)
1095 )
1096 res_expl = self.explanation_param(self.display(res))
1097 pat = "%s\n{%s = %s.%s\n}"
1098 expl = pat % (res_expl, res_expl, value_expl, attr.attr)
1099 return res, expl
1100
1101 def visit_Compare(self, comp: ast.Compare) -> tuple[ast.expr, str]:
1102 self.push_format_context()

Callers

nothing calls this directly

Calls 5

generic_visitMethod · 0.95
assignMethod · 0.95
explanation_paramMethod · 0.95
displayMethod · 0.95
visitMethod · 0.80

Tested by

no test coverage detected