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
+31
View File
@@ -559,6 +559,37 @@ class TestSheerkaUsingMemoryBasedSheerka(TestUsingMemoryBasedSheerka):
ret_val = ReturnValueConcept("Test", True, sheerka.err("an error"))
assert sheerka.get_errors(context, ret_val) == []
def test_i_can_add_and_remove_global_context_hints(self):
sheerka, context = self.init_test().unpack()
sheerka.add_to_context(BuiltinConcepts.EVAL_QUESTION_REQUESTED)
assert sheerka._global_context_hints == {BuiltinConcepts.EVAL_QUESTION_REQUESTED}
sheerka.remove_fom_context(BuiltinConcepts.EVAL_QUESTION_REQUESTED)
assert sheerka._global_context_hints == set()
sheerka.add_to_context(sheerka.new(BuiltinConcepts.EVAL_QUESTION_REQUESTED))
assert sheerka._global_context_hints == {BuiltinConcepts.EVAL_QUESTION_REQUESTED}
sheerka.remove_fom_context(sheerka.new(BuiltinConcepts.EVAL_QUESTION_REQUESTED))
assert sheerka._global_context_hints == set()
def test_global_context_hints_are_added_to_every_user_input_execution(self):
sheerka, context, foo = self.init_test().with_concepts(
Concept("foo", pre="in_context(BuiltinConcepts.EVAL_GLOBAL_TRUTH_REQUESTED)")
).unpack()
res = sheerka.evaluate_user_input("eval foo", "testing_user")
assert sheerka.isinstance(res[0].value, BuiltinConcepts.CONDITION_FAILED) # sanity check
sheerka.add_to_context(BuiltinConcepts.EVAL_GLOBAL_TRUTH_REQUESTED)
res = sheerka.evaluate_user_input("eval foo", "testing_user")
assert sheerka.isinstance(res[0].value, "foo")
sheerka.remove_fom_context(BuiltinConcepts.EVAL_GLOBAL_TRUTH_REQUESTED)
res = sheerka.evaluate_user_input("eval foo", "testing_user")
assert sheerka.isinstance(res[0].value, BuiltinConcepts.CONDITION_FAILED)
class TestSheerkaUsingFileBasedSheerka(TestUsingFileBasedSheerka):