Implemented SheerkaOntology
This commit is contained in:
@@ -18,19 +18,26 @@ cmap = {
|
||||
|
||||
|
||||
class TestDefFormatRuleParser(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="#TestDefFormatRuleParser#")
|
||||
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 = TestDefFormatRuleParser.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 = DefFormatRuleParser()
|
||||
return sheerka, context, parser
|
||||
@@ -134,4 +141,3 @@ class TestDefFormatRuleParser(TestUsingMemoryBasedSheerka):
|
||||
|
||||
assert res.status
|
||||
assert format_ast == expected
|
||||
|
||||
|
||||
Reference in New Issue
Block a user