Get arrays and mappings working
This commit is contained in:
parent
8db42aa17d
commit
d6a811118d
5 changed files with 46 additions and 9 deletions
projects/lilith/test/python
|
@ -22,6 +22,11 @@ def arguments_grammar():
|
|||
return parser_with_transformer(GRAMMAR, "arguments")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def expr_grammar():
|
||||
return parser_with_transformer(GRAMMAR, "expr")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def header_grammar():
|
||||
return parser_with_transformer(GRAMMAR, "header")
|
||||
|
|
|
@ -60,6 +60,21 @@ def test_parse_arguments(arguments_grammar, example, expected):
|
|||
assert arguments_grammar.parse(example) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"example, expected",
|
||||
[
|
||||
("1", 1),
|
||||
("[1, 2, 3]", [1, 2, 3]),
|
||||
('{"a": 1}', {"a": 1}),
|
||||
("true", True),
|
||||
("false", False),
|
||||
("nil", None),
|
||||
],
|
||||
)
|
||||
def test_parse_expr(expr_grammar, example, expected):
|
||||
assert expr_grammar.parse(example) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"example, expected",
|
||||
[
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue