Fixed #100 : SheerkaAdmin: Add builtins() command

Fixed #99 : SheerkaQueryManager: I can manage contains predicate when filtering objects
Fixed #97 : ERROR: list indices must be integers or slices, not Concept
Fixed #96 : SequenceNodeParser: SequenceNodeParser must correctly handle concept definition
Fixed #95 : ResolveAmbiguity must not remove concepts that do not require evaluation
Fixed #94 : Concepts with the same key are lost when new ontology
Fixed #93 : Introduce BuiltinConcepts.EVAL_GLOBAL_TRUTH_REQUESTED
Fixed #92 : ExpressionParser: Implement compile_disjunctions()
Fixed #91 : Implement get_concepts_complexity(context, concepts, concept_parts)
Fixed #90 : ResolveAmbiguity : where predicate is not used to resolve ambiguity
Fixed #89 : ResolveAmbiguityEvaluator: Concepts embedded in ConceptNode are not resolved
Fixed #88: SyaNodeParser: Parse multiple parameters when some of the are not recognized
Fixed #87: SyaNodeParser : Parse the multiple parameters
This commit is contained in:
2021-07-31 08:52:00 +02:00
parent 7dcaa9c111
commit e69745adc8
70 changed files with 1561 additions and 455 deletions
+19 -5
View File
@@ -104,7 +104,7 @@ class BaseTest:
def get_sheerka(self, **kwargs) -> Sheerka:
pass
def get_context(self, sheerka=None, eval_body=False, eval_where=False, message=""):
def get_context(self, sheerka=None, eval_body=False, eval_where=False, global_truth=False, message=""):
context = ExecutionContext("test",
Event(message=message),
sheerka or self.get_sheerka(),
@@ -114,20 +114,29 @@ class BaseTest:
context.protected_hints.add(BuiltinConcepts.EVAL_BODY_REQUESTED)
if eval_where:
context.protected_hints.add(BuiltinConcepts.EVAL_WHERE_REQUESTED)
if global_truth:
context.protected_hints.add(BuiltinConcepts.EVAL_GLOBAL_TRUTH_REQUESTED)
return context
@staticmethod
def get_init_test_args(**kwargs):
return {k: v for k, v in kwargs.items() if k in ["cache_only", "ontology", "eval_body", "eval_where"]}
return {k: v for k, v in kwargs.items() if k in ["cache_only",
"ontology",
"eval_body",
"eval_where",
"global_truth"]}
@staticmethod
def get_with_concepts_args(**kwargs):
return {k: v for k, v in kwargs.items() if k in ["create_new"]}
def init_test(self, cache_only=None, ontology=None, eval_body=False, eval_where=False):
def init_test(self, cache_only=None, ontology=None, eval_body=False, eval_where=False, global_truth=False):
sheerka = self.get_sheerka(cache_only=cache_only, ontology=ontology)
context = self.get_context(sheerka=sheerka, eval_body=eval_body, eval_where=eval_where)
context = self.get_context(sheerka=sheerka,
eval_body=eval_body,
eval_where=eval_where,
global_truth=global_truth)
return InitTestHelper(sheerka, context)
@@ -255,14 +264,19 @@ class BaseTest:
concept.get_metadata().variables[k] = v
return concept
def init_scenario(self, init_expressions):
def init_scenario(self, init_expressions, global_truth=False):
sheerka = self.get_sheerka()
if global_truth:
sheerka.add_to_context(BuiltinConcepts.EVAL_GLOBAL_TRUTH_REQUESTED)
for expression in init_expressions:
res = sheerka.evaluate_user_input(expression)
assert len(res) == 1, f"Failed to execute '{expression}'"
assert res[0].status, f"Error while executing '{expression}'"
if global_truth:
sheerka.remove_fom_context(BuiltinConcepts.EVAL_GLOBAL_TRUTH_REQUESTED)
return sheerka
@staticmethod