Fixed memory() and RET usage

This commit is contained in:
2020-09-21 21:30:38 +02:00
parent 177a6b1d5f
commit dd520c1680
37 changed files with 816 additions and 353 deletions
@@ -1,5 +1,4 @@
import pytest
from core.builtin_concepts import ReturnValueConcept, BuiltinConcepts
from core.concept import Concept
from evaluators.TooManySuccessEvaluator import TooManySuccessEvaluator
@@ -44,8 +43,8 @@ class TestTooManySuccessEvaluator(TestUsingMemoryBasedSheerka):
def test_i_can_eval(self):
context = self.get_context()
value1 = r("evaluators.a", value=Concept("c1", body="1"))
value2 = r("evaluators.a", value=Concept("c2", body="2"))
value1 = r("evaluators.a", value=Concept("c1", body="1").auto_init())
value2 = r("evaluators.a", value=Concept("c2", body="2").auto_init())
return_values = [
value1,
value2,
@@ -80,6 +79,23 @@ class TestTooManySuccessEvaluator(TestUsingMemoryBasedSheerka):
assert matches
assert res is None
def test_i_do_not_eval_when_the_concepts_are_not_evaluated(self):
context = self.get_context()
return_values = [
r("evaluators.a", value=Concept("c1", body="1")),
r("evaluators.a", value=Concept("c2", body="2")),
r("other", False),
reduce_requested
]
evaluator = TooManySuccessEvaluator()
matches = evaluator.matches(context, return_values)
res = evaluator.eval(context, return_values)
assert matches
assert res is None
def test_other_success_are_not_reduced(self):
context = self.get_context()