Implemented SheerkaOntology
This commit is contained in:
@@ -18,19 +18,26 @@ cmap = {
|
||||
|
||||
|
||||
class TestFunctionParser(TestUsingMemoryBasedSheerka):
|
||||
sheerka = None
|
||||
shared_ontology = None
|
||||
|
||||
@classmethod
|
||||
def setup_class(cls):
|
||||
t = cls()
|
||||
cls.sheerka, context, _ = t.init_parser(cmap)
|
||||
init_test_helper = cls().init_test(cache_only=False, ontology="#TestFunctionParser#")
|
||||
sheerka, context, *updated = init_test_helper.with_concepts(*cmap.values(), create_new=True).unpack()
|
||||
for i, concept_name in enumerate(cmap):
|
||||
cmap[concept_name] = updated[i]
|
||||
|
||||
def init_parser(self, concepts_map=None):
|
||||
if concepts_map is not None:
|
||||
sheerka, context, *concepts = self.init_concepts(*concepts_map.values(), create_new=True)
|
||||
cls.shared_ontology = sheerka.get_ontology(context)
|
||||
sheerka.pop_ontology()
|
||||
|
||||
def init_parser(self, my_concepts_map=None, **kwargs):
|
||||
if my_concepts_map is None:
|
||||
sheerka, context = self.init_test().unpack()
|
||||
sheerka.add_ontology(context, self.shared_ontology)
|
||||
else:
|
||||
sheerka = TestFunctionParser.sheerka
|
||||
context = self.get_context(sheerka)
|
||||
sheerka, context, *updated = self.init_test().with_concepts(*my_concepts_map.values(), **kwargs).unpack()
|
||||
for i, pair in enumerate(my_concepts_map):
|
||||
my_concepts_map[pair] = updated[i]
|
||||
|
||||
parser = FunctionParser()
|
||||
return sheerka, context, parser
|
||||
@@ -244,4 +251,3 @@ class TestFunctionParser(TestUsingMemoryBasedSheerka):
|
||||
assert isinstance(concept.get_compiled()["b"], list)
|
||||
for item in concept.get_compiled()["b"]:
|
||||
assert sheerka.isinstance(item, BuiltinConcepts.RETURN_VALUE)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user