def test_clean_linq_arb_var_names():
    q = '(lambda (list a0 f1) (+ a0 f1))'
    assert clean_linq(q) == '(lambda (list a0 a1) (+ a0 a1))'
def test_clean_linq_empty():
    q = ''
    assert clean_linq(q) == ""
def test_clean_linq_funny_var_names():
    q = '(lambda (list e0 e000) (+ e000 e0))'
    assert clean_linq(q) == '(lambda (list a0 a1) (+ a1 a0))'
def test_clean_linq_nested_lambda():
    q = '(lambda (list e0 e1) (+ (call (lambda (list e0) (+ e0 1)) e0) e1))'
    assert clean_linq(
        q
    ) == '(lambda (list a1 a2) (+ (call (lambda (list a0) (+ a0 1)) a1) a2))'
def test_clean_linq_many_args():
    q = '(lambda (list e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 e10 e11) ' \
        '(+ e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 e10 e11))'
    assert clean_linq(q) == '(lambda (list a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11) ' \
        '(+ a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11))'
def test_clean_linq_single_lambda():
    q = '(lambda (list e0 e1) (+ e0 e1))'
    assert clean_linq(q) == '(lambda (list a0 a1) (+ a0 a1))'
def test_clean_linq_invalid_qastle():
    q = '(lambda a (+ a 1))'
    assert clean_linq(q) == q
def test_clean_linq_bad_lambda():
    q = '(lambda a (+ a 1) (1 2 3))'
    assert clean_linq(q) == q
def test_clean_linq_no_lambda():
    q = '(valid qastle)'
    assert clean_linq(q) == q