예제 #1
0
def test_ignore_constructors():
    visitor = Visitor(ignore=(
        'complex',
        'dict',
        'float',
        'int',
        'list',
        'str',
        'tuple',
    ))
    visitor.visit(ast.parse(BUILTIN_CONSTRUCTORS))
    assert visitor.builtin_type_calls == []
def visitor():
    return Visitor()
def test_dict_no_allow_kwargs_exprs(expression, calls):
    visitor = Visitor(allow_dict_kwargs=False)
    visitor.visit(ast.parse(expression))
    assert visitor.builtin_type_calls == calls
def test_ignore_constructors():
    visitor = Visitor(ignore=(
        'complex', 'dict', 'float', 'int', 'list', 'str', 'tuple',
    ))
    visitor.visit(ast.parse(BUILTIN_CONSTRUCTORS))
    assert visitor.builtin_type_calls == []
def test_dict_no_allow_kwargs_exprs(expression, calls):
    visitor = Visitor(allow_dict_kwargs=False)
    visitor.visit(ast.parse(expression))
    assert visitor.builtin_type_calls == calls