예제 #1
0
파일: test_lsp.py 프로젝트: lucian1900/lsp
def test_parse_list():
    assert parse(['(', '1', '2', ')']) == List([1, 2])

    assert parse(['(', '1', '(', '2', '3', ')', ')']) == \
        List([1, List([2, 3])])
    assert parse(['(', '(', '1', '2', ')', '3', ')']) == \
        List([List([1, 2]), 3])
    assert parse(['(', '1', '(', '2', ')', '3', ')']) == \
        List([1, List([2]), 3])
    assert parse(['(', '(', '1', ')', '(', '2', ')', ')']) == \
        List([List([1]), List([2])])
예제 #2
0
파일: test_lsp.py 프로젝트: lucian1900/lsp
def test_parse_unmatched():
    with raises(SyntaxError):
        assert parse(['('])
예제 #3
0
파일: test_lsp.py 프로젝트: lucian1900/lsp
def test_parse_map():
    assert parse(['{', '1', '2', '}']) == {1: 2}
    assert parse(['{', '1', '2', '3', '4', '}']) == {1: 2, 3: 4}
    assert parse(['{', '1', '2', '3', '}']) == {1: 2}
예제 #4
0
파일: test_lsp.py 프로젝트: lucian1900/lsp
def test_parse_vector():
    assert parse(['[', '1', '2', ']']) == [1, 2]
예제 #5
0
파일: test_lsp.py 프로젝트: lucian1900/lsp
def test_bool():
    assert parse(['true']) == True
    assert parse(['true']) == parse(['true'])

    assert not parse(['false'])
    assert parse(['false']) == False
예제 #6
0
파일: test_lsp.py 프로젝트: lucian1900/lsp
def test_read_atom():
    assert parse(['1']) == 1
    assert parse(['1/3']) == Fraction(1, 3)
    assert parse(['true'])
    assert parse(['nil']) == Nil()