예제 #1
0
파일: test_lang.py 프로젝트: bodak/hmrb
def test_var_parse_missing_quotes():
    var_string = """Var some_name:
(
    (lemma: word1)
)"""
    with pytest.raises(ValueError):
        Var(var_string.split("\n"), {})
예제 #2
0
파일: test_lang.py 프로젝트: bodak/hmrb
def test_var_parse_empty_ref_in_block():
    var_string = """Var some_name:
(
    ($)
)"""
    with pytest.raises(ValueError):
        Var(var_string.split("\n"), {})
예제 #3
0
파일: test_lang.py 프로젝트: bodak/hmrb
def test_var_parse_bad_block():
    var_string = """Var some_name:
(
    (bad block content)
)"""
    with pytest.raises(ValueError):
        Var(var_string.split("\n"), {})
예제 #4
0
파일: test_lang.py 프로젝트: bodak/hmrb
def test_var_parse_escaped_quotes():
    var_string = """Var some_name:
(
    (lemma: \\"word1\\")
)
"""
    with pytest.raises(ValueError):
        Var(var_string.split("\n"), {})
예제 #5
0
파일: test_lang.py 프로젝트: bodak/hmrb
def test_var_parse_att_unescaped_quote():
    var_string = """Var some_name:
(
    (att: " " ")
)"""
    with pytest.raises(ValueError):
        lines = [(s, -1) for s in var_string.split("\n")]
        Var(lines, {})
예제 #6
0
파일: test_lang.py 프로젝트: bodak/hmrb
def test_var_parse_missing_brackets():
    var_string = """Var some_name:
(
    (lemma: "word1")
    lemma: "word2"
)
"""
    with pytest.raises(ValueError):
        Var(var_string.split("\n"), {})
예제 #7
0
파일: test_lang.py 프로젝트: bodak/hmrb
def test_var_parse_empty():
    var_string = """Var some_name:
(
    ( (   ) )
)"""
    lines = [(s, -1) for s in var_string.split("\n")]
    var = Var(lines, {})
    assert var.name == "some_name"
    assert len(var.body.members) == 0
    assert var.body.union is False
예제 #8
0
파일: test_lang.py 프로젝트: bodak/hmrb
def test_var_parse():
    var_string = """Var some_name:
(
    (lemma: \"word1\")
    (lemma: \"word2\")
)"""
    lines = [(s, -1) for s in var_string.split("\n")]
    var = Var(lines, {})
    assert var.name == "some_name"
    assert len(var.body.members) == 2
    assert var.body.union is False
예제 #9
0
파일: test_lang.py 프로젝트: bodak/hmrb
def test_var_parse_att_escaped_quote():
    var_string = """Var some_name:
(
    (att: " \\" ")
)"""
    lines = [(s, -1) for s in var_string.split("\n")]
    var = Var(lines, {})
    assert var.name == "some_name"
    assert len(var.body.members) == 1
    assert var.body.union is False
    assert var.body.members[0].atts["att"] == ' " '
예제 #10
0
파일: test_lang.py 프로젝트: bodak/hmrb
def test_var_parse_att_quoted_brackets():
    var_string = """Var some_name:
(
    (att: " ) ")
    (att: " ( ")
    (att: " ())( ")
    (att: " )))))))))))))))) ")
)"""
    vals = [" ) ", " ( ", " ())( ", " )))))))))))))))) "]
    lines = [(s, -1) for s in var_string.split("\n")]
    var = Var(lines, {})
    assert var.name == "some_name"
    assert len(var.body.members) == 4
    assert var.body.union is False
    for m, v in zip(var.body.members, vals):
        assert m.atts["att"] == v
예제 #11
0
파일: test_lang.py 프로젝트: bodak/hmrb
def test_var_parse_bad_name(var_string):
    with pytest.raises(ValueError):
        Var(var_string.split("\n"), {})