source/projects/datalog/test/python/test_datalog_reader.py

33 lines
532 B
Python
Raw Normal View History

2021-05-15 05:39:18 +00:00
"""
Reader tests.
"""
2021-05-31 18:28:46 +00:00
from datalog.reader import read
2021-05-15 05:39:18 +00:00
import pytest
EXS = [
"%foo\n",
"""a(b).""",
"""edge(a).""",
"""a(b, c).""",
"""edge(smfc-ait, smfc).""",
"""edge("smfc-ait", smfc).""",
"""path(A, B) :- edge(A, C), path(C, B).""",
"""path(A, B) :-
edge(A, C),
path(C, B).""",
"""path(A, B) :- % one comment
edge(A, C), % the next
path(C, B).""",
"""foo(A, B) :-
~bar(A, B),
qux(A, B).""",
]
@pytest.mark.parametrize("ex,", EXS)
def test_reader(ex):
assert read(ex)