Added is_lesser and is_greatest in SheerkaComparison
This commit is contained in:
@@ -167,7 +167,7 @@ as:
|
||||
|
||||
assert len(res) == 1
|
||||
assert not res[0].status
|
||||
assert sheerka.isinstance(res[0].value, BuiltinConcepts.CONCEPT_ALREADY_DEFINED)
|
||||
assert sheerka.isinstance(res[0].value, BuiltinConcepts.ALREADY_DEFINED)
|
||||
|
||||
@pytest.mark.parametrize("text", [
|
||||
"",
|
||||
@@ -891,16 +891,17 @@ as:
|
||||
assert sheerka.get_concepts_weights("some_prop") == {'1001': 1, '1002': 2, '1003': 3, '1004': 4}
|
||||
|
||||
def test_i_can_evaluate_expression_when_using_token_concept(self):
|
||||
sheerka, context, one, two, plus = self.init_concepts(
|
||||
sheerka, context, one, two, three, is_less_than = self.init_concepts(
|
||||
Concept("one", body="1"),
|
||||
Concept("two", body="2"),
|
||||
Concept("three", body="3"),
|
||||
self.from_def_concept("<", "a < b", ["a", "b"], body="set_is_less_than('some_prop', a, b)")
|
||||
)
|
||||
|
||||
expression = "c:one: < c:two:"
|
||||
res = sheerka.evaluate_user_input(expression)
|
||||
assert res[0].status
|
||||
assert res[0].body == CMV(plus, a="c:one:", b="c:two:")
|
||||
assert res[0].body == CMV(is_less_than, a="c:one:", b="c:two:")
|
||||
assert res[0].body.a == NotInit # concept is not evaluated
|
||||
assert res[0].body.b == NotInit # concept is not evaluated
|
||||
|
||||
@@ -911,11 +912,11 @@ as:
|
||||
assert sheerka.get_concepts_weights("some_prop") == {'1001': 1, '1002': 2}
|
||||
|
||||
# it now also works using the concepts names
|
||||
expression = "eval one < two"
|
||||
expression = "eval two < three"
|
||||
res = sheerka.evaluate_user_input(expression)
|
||||
assert res[0].status
|
||||
assert sheerka.isinstance(res[0].body, BuiltinConcepts.SUCCESS)
|
||||
assert sheerka.get_concepts_weights("some_prop") == {'1001': 1, '1002': 2}
|
||||
assert sheerka.get_concepts_weights("some_prop") == {'1001': 1, '1002': 2, '1003': 3}
|
||||
|
||||
def test_i_can_detect_multiple_errors_when_evaluating_a_concept(self):
|
||||
sheerka, context, foo, plus_one = self.init_concepts(
|
||||
|
||||
Reference in New Issue
Block a user