EvalEvaluator is called only if in root context. Added action and action_context to ExecutionContext
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import pytest
|
||||
|
||||
from core.builtin_concepts import ReturnValueConcept, BuiltinConcepts
|
||||
from core.concept import Concept
|
||||
from core.sheerka.services.SheerkaSetsManager import SheerkaSetsManager
|
||||
from evaluators.EvalEvaluator import EvalEvaluator
|
||||
|
||||
from tests.TestUsingMemoryBasedSheerka import TestUsingMemoryBasedSheerka
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ class TestEvalEvaluator(TestUsingMemoryBasedSheerka):
|
||||
|
||||
return_values = [
|
||||
ReturnValueConcept("some_name", True, "not to eval"),
|
||||
ReturnValueConcept("some_name", True, Concept(name="not to eval")),
|
||||
ReturnValueConcept("some_name", False, Concept(name="1", body="'not to eval'")),
|
||||
ReturnValueConcept("some_name", True, Concept(name="not to eval")), # no body
|
||||
ReturnValueConcept("some_name", False, Concept(name="1", body="'not to eval'")), # status is false
|
||||
to_eval1,
|
||||
to_eval2,
|
||||
]
|
||||
@@ -52,6 +52,25 @@ class TestEvalEvaluator(TestUsingMemoryBasedSheerka):
|
||||
context.global_hints.add(BuiltinConcepts.CONCEPT_VALUE_REQUESTED)
|
||||
assert EvalEvaluator().matches(context, [return_value])
|
||||
|
||||
def test_i_can_match_depending_on_builtin_concept_processing(self):
|
||||
context = self.get_context()
|
||||
context.global_hints.add(BuiltinConcepts.CONCEPT_VALUE_REQUESTED)
|
||||
return_values = [ReturnValueConcept("some_name", True, Concept(name="2", body="to eval").auto_init())]
|
||||
evaluator = EvalEvaluator()
|
||||
|
||||
# i match when no BuiltinConcepts.PROCESSING is found
|
||||
assert evaluator.matches(context, return_values)
|
||||
|
||||
# i match when one BuiltinConcepts.PROCESSING is found
|
||||
root_processing = context.push(BuiltinConcepts.PROCESSING, {"step": BuiltinConcepts.EVALUATION}). \
|
||||
push(BuiltinConcepts.NOP, None)
|
||||
assert evaluator.matches(root_processing, return_values)
|
||||
|
||||
# otherwise, i cannot match
|
||||
sub_root = root_processing.push(BuiltinConcepts.PROCESSING, {"step": BuiltinConcepts.EVALUATION}). \
|
||||
push(BuiltinConcepts.NOP, None)
|
||||
assert not evaluator.matches(sub_root, return_values)
|
||||
|
||||
def test_concept_eval_requested_is_reduced_when_nothing_to_reduce(self):
|
||||
context = self.get_context()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user