Exemplo n.º 1
0
def test_unparse_int():
    assert_equals("1", unparse(1))
    assert_equals("1337", unparse(1337))
    assert_equals("-42", unparse(-42))
Exemplo n.º 2
0
def test_unparse_quotes():
    assert_equals("''(foo 'bar '(1 2))", unparse(
        ["quote", ["quote", ["foo", ["quote", "bar"], ["quote", [1, 2]]]]]))
Exemplo n.º 3
0
def test_unparse_bool():
    assert_equals("#t", unparse(True))
    assert_equals("#f", unparse(False))
Exemplo n.º 4
0
def test_unparse_atoms():
    assert_equals("123", unparse(123))
    assert_equals("#t", unparse(True))
    assert_equals("#f", unparse(False))
    assert_equals("foo", unparse("foo"))
Exemplo n.º 5
0
def test_unparse_list():
    assert_equals("((foo bar) baz)", unparse([["foo", "bar"], "baz"]))
Exemplo n.º 6
0
def test_unparse_other_quotes():
    assert_equals("'foo", unparse(["quote", "foo"]))
    assert_equals("'(1 2 3)",
                  unparse(["quote", [1, 2, 3]]))
Exemplo n.º 7
0
def test_expand_crazy_quote_combo():
    """TEST 1.14: One final test to see that quote expansion works."""

    source = "'(this ''''(makes ''no) 'sense)"
    assert_equals(source, unparse(parse(source)))
Exemplo n.º 8
0
def test_unparse_symbol():
    assert_equals("+", unparse("+"))
    assert_equals("foo", unparse("foo"))
    assert_equals("lambda", unparse("lambda"))
Exemplo n.º 9
0
def test_unparse_another_list():
    assert_equals("(1 2 3)", unparse([1, 2, 3]))
    assert_equals("(if #t 42 #f)", unparse(["if", True, 42, False]))
Exemplo n.º 10
0
def test_unparse_bool():
    assert_equals("#t", unparse(True))
    assert_equals("#f", unparse(False))
Exemplo n.º 11
0
def test_unparse_int():
    assert_equals("1", unparse(1))
    assert_equals("1337", unparse(1337))
    assert_equals("-42", unparse(-42))
Exemplo n.º 12
0
def test_unparse_quotes():
    assert_equals(
        "''(foo 'bar '(1 2))",
        unparse(
            ["quote", ["quote", ["foo", ["quote", "bar"], ["quote", [1,
                                                                     2]]]]]))
Exemplo n.º 13
0
def test_unparse_list():
    assert_equals("((foo bar) baz)", unparse([["foo", "bar"], "baz"]))
Exemplo n.º 14
0
def test_unparse_atoms():
    assert_equals("123", unparse(123))
    assert_equals("#t", unparse(True))
    assert_equals("#f", unparse(False))
    assert_equals("foo", unparse("foo"))
Exemplo n.º 15
0
def test_unparse_symbol():
    assert_equals("+", unparse("+"))
    assert_equals("foo", unparse("foo"))
    assert_equals("lambda", unparse("lambda"))
Exemplo n.º 16
0
def test_unparse_other_quotes():
    assert_equals("'foo", unparse(["quote", "foo"]))
    assert_equals("'(1 2 3)", unparse(["quote", [1, 2, 3]]))
Exemplo n.º 17
0
def test_unparse_another_list():
    assert_equals("(1 2 3)", unparse([1, 2, 3]))
    assert_equals("(if #t 42 #f)",
                  unparse(["if", True, 42, False]))
Exemplo n.º 18
0
def test_unparse_empty_list():
    assert_equals("()", unparse([]))
Exemplo n.º 19
0
def test_unparse_empty_list():
    assert_equals("()", unparse([]))
Exemplo n.º 20
0
def test_expand_crazy_quote_combo():
    """One final test to see that quote expansion works."""

    source = "'(this ''''(makes ''no) 'sense)"
    assert_equals(source, unparse(parse(source)))