def test_get_annotation_assignattr(init_method, label): """AssignAttr.""" assign = rf""" class A: {init_method} """ node = astroid.extract_node(assign) instance_attrs = node.instance_attrs for assign_attrs in instance_attrs.values(): for assign_attr in assign_attrs: got = get_annotation(assign_attr).name assert isinstance(assign_attr, nodes.AssignAttr) assert got == label, f"got {got} instead of {label} for value {node}"
def test_get_annotation_annassign(assign, label): """AnnAssign.""" node = astroid.extract_node(assign) got = get_annotation(node.value).name assert isinstance(node, nodes.AnnAssign) assert got == label, f"got {got} instead of {label} for value {node}"