def test_correct_slots(
    assert_errors,
    parse_ast_tree,
    default_options,
    code,
):
    """Testing that correct slots are allowed."""
    tree = parse_ast_tree(class_body_template.format(code))

    visitor = WrongSlotsVisitor(default_options, tree=tree)
    visitor.run()

    assert_errors(visitor, [])
Exemple #2
0
def test_incorrect_slots(
    assert_errors,
    parse_ast_tree,
    default_options,
    code,
    template,
):
    """Testing that incorrect slots are prohibited."""
    tree = parse_ast_tree(template.format(code))

    visitor = WrongSlotsVisitor(default_options, tree=tree)
    visitor.run()

    assert_errors(visitor, [WrongSlotsViolation])