Added ExactConceptParser

This commit is contained in:
2019-11-09 17:29:50 +01:00
parent a636198222
commit 576ce77740
12 changed files with 603 additions and 169 deletions
+38
View File
@@ -0,0 +1,38 @@
import pytest
from core.concept import Concept
@pytest.mark.parametrize("name, variables, expected", [
("my name is a", ["a"], "my name is __var__0"),
("a b c d", ["b", "c"], "a __var__0 __var__1 d"),
("a 'b c' d", ["b", "c"], "a b c d"),
("a | b", ["a", "b"], "__var__0 | __var__1"),
("a b a c", ["a", "b"], "__var__0 __var__1 __var__0 c"),
("a b a c", ["b", "a"], "__var__1 __var__0 __var__1 c"),
])
def test_i_can_get_concept_key(name, variables, expected):
concept = Concept(name)
for v in variables:
concept.set_prop(v, None)
concept.init_key()
assert concept.key == expected
def test_i_can_serialize():
"""
Test concept.to_dict()
:return:
"""
# TODO
pass
def test_i_can_deserialize():
"""
Test concept.from_dict()
:return:
"""
# TODO
pass