48 lines
2.0 KiB
Python
48 lines
2.0 KiB
Python
# import pytest
|
|
# from core.builtin_concepts import ReturnValueConcept
|
|
# from core.concept import Concept
|
|
# from evaluators.RetEvaluator import RetEvaluator
|
|
#
|
|
# from tests.BaseTest import BaseTest
|
|
# from tests.TestUsingMemoryBasedSheerka import TestUsingMemoryBasedSheerka
|
|
#
|
|
#
|
|
# class TestRetEvaluator(TestUsingMemoryBasedSheerka):
|
|
#
|
|
# @pytest.mark.parametrize("ret_val, expected", [
|
|
# (ReturnValueConcept("who", True, Concept("foo", ret="bar")), True),
|
|
# (ReturnValueConcept("who", False, Concept("foo", ret="bar")), False),
|
|
# (ReturnValueConcept("who", True, Concept("foo")), False),
|
|
# (BaseTest.pretval(Concept("foo", ret="bar")), False),
|
|
# (ReturnValueConcept("who", True, "not even a concept"), False),
|
|
# ])
|
|
# def test_i_can_match(self, ret_val, expected):
|
|
# context = self.get_context()
|
|
# assert RetEvaluator().matches(context, ret_val) == expected
|
|
#
|
|
# def test_i_can_evaluate_fully_initialized(self):
|
|
# sheerka, context, foo, the_concept = self.init_concepts("foo", Concept("the concept", ret="a").def_var("a"))
|
|
#
|
|
# instance = sheerka.new("the concept")
|
|
# instance.set_value("a", sheerka.new("foo"))
|
|
# ret_value = self.tretval(sheerka, instance)
|
|
#
|
|
# res = RetEvaluator().eval(context, ret_value)
|
|
# assert res.status
|
|
# assert sheerka.isinstance(res.body, "foo")
|
|
#
|
|
# @pytest.mark.parametrize("instance, expected", [
|
|
# (Concept("with ret", ret="a").def_var("a", "foo"), "foo"),
|
|
# (Concept("with ret", ret="a", body="10").def_var("a", "foo"), "foo"),
|
|
# (Concept("with ret", ret="a").def_var("a", "bar"), "bar"),
|
|
# ])
|
|
# def test_i_can_evaluate(self, instance, expected):
|
|
# sheerka, context, foo, bar = self.init_concepts("foo", Concept("bar", body="10"))
|
|
#
|
|
# ret_value = self.tretval(sheerka, instance)
|
|
#
|
|
# res = RetEvaluator().eval(context, ret_value)
|
|
# assert res.status
|
|
# assert sheerka.isinstance(res.body, expected)
|
|
#
|