def test_unparse_empty_list(): assert_equals("()", unparse([]))
def test_unparse_list(): assert_equals("(1 2 3)", unparse([1, 2, 3])) assert_equals("(if True 42 False)", unparse(["if", True, 42, False]))
def test_unparse_quotes(): assert_equals("'foo", unparse(["quote", "foo"])) assert_equals("'(1 2 3)", unparse(["quote", [1, 2, 3]]))
def test_unparse_int(): assert_equals("1", unparse(1)) assert_equals("1337", unparse(1337)) assert_equals("-42", unparse(-42))
def test_unparse_symbol(): assert_equals("+", unparse("+")) assert_equals("foo", unparse("foo")) assert_equals("lambda", unparse("lambda"))
def test_unparse_bool(): assert_equals("True", unparse(True)) assert_equals("False", unparse(False))
def test_unparse_quotes(): assert_equals("''(foo 'bar '(1 2))", unparse( ["quote", ["quote", ["foo", ["quote", "bar"], ["quote", [1, 2]]]]]))
def test_unparse_list(): assert_equals("((foo bar) baz)", unparse([["foo", "bar"], "baz"]))
def test_unparse_atoms(): assert_equals("123", unparse(123)) assert_equals("True", unparse(True)) assert_equals("False", unparse(False)) assert_equals("foo", unparse("foo"))
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)))