Added ModifyConcept function, and fixed 'isa' not working

This commit is contained in:
2020-02-20 11:30:53 +01:00
parent 87f232b527
commit 7cd94e888f
17 changed files with 750 additions and 228 deletions
+7 -4
View File
@@ -36,23 +36,26 @@ class BaseTest:
def init_concepts(self, *concepts, **kwargs):
sheerka = self.get_sheerka(**kwargs)
context = self.get_context(sheerka)
create_new = kwargs.get("create_new", False)
result = []
for c in concepts:
if isinstance(c, str):
c = Concept(c)
c.init_key()
sheerka.set_id_if_needed(c, False)
# manage concepts with bnf definitions
if c.metadata.definition:
bnf_parser = BnfParser()
res = bnf_parser.parse(context, c.metadata.definition)
if res.status:
c.bnf = res.value.value
sheerka.create_new_concept(context, c)
elif create_new:
sheerka.create_new_concept(context, c)
else:
c.init_key()
sheerka.set_id_if_needed(c, False)
sheerka.add_in_cache(c)
sheerka.add_in_cache(c)
result.append(c)
return sheerka, context, *result