Concept validation must be requested
This commit is contained in:
+23
-21
@@ -17,32 +17,34 @@ def is_same_success(context, return_values):
|
||||
"""
|
||||
assert isinstance(return_values, list)
|
||||
|
||||
if not return_values[0].status:
|
||||
return False
|
||||
def _get_value(ret_val):
|
||||
if not ret_val.status:
|
||||
raise Exception("Status is false")
|
||||
|
||||
if isinstance(return_values[0].body, Concept):
|
||||
evaluated = context.sheerka.evaluate_concept(context, return_values[0].body, True)
|
||||
if evaluated.key != return_values[0].body.key:
|
||||
return False
|
||||
reference = context.sheerka.value(evaluated)
|
||||
else:
|
||||
reference = context.sheerka.value(return_values[0])
|
||||
if isinstance(ret_val.body, Concept):
|
||||
if not ret_val.body.metadata.is_evaluated:
|
||||
with context.push(desc=f"Evaluating concept '{ret_val.body}'") as sub_context:
|
||||
sub_context.local_hints.add(BuiltinConcepts.EVAL_BODY_REQUESTED)
|
||||
evaluated = context.sheerka.evaluate_concept(sub_context, ret_val.body)
|
||||
if evaluated.key != ret_val.body.key:
|
||||
raise Exception("Failed to evaluate evaluate")
|
||||
return context.sheerka.value(evaluated)
|
||||
else:
|
||||
return context.sheerka.value(ret_val.body)
|
||||
else:
|
||||
return context.sheerka.value(ret_val)
|
||||
|
||||
for return_value in return_values[1:]:
|
||||
if not return_value.status:
|
||||
return False
|
||||
try:
|
||||
reference = _get_value(return_values[0])
|
||||
|
||||
if isinstance(return_value.body, Concept):
|
||||
evaluated = context.sheerka.evaluate_concept(context, return_value.body, True)
|
||||
if evaluated.key != return_value.body.key:
|
||||
for return_value in return_values[1:]:
|
||||
actual = _get_value(return_value)
|
||||
if actual != reference:
|
||||
return False
|
||||
|
||||
actual = context.sheerka.value(evaluated)
|
||||
else:
|
||||
actual = context.sheerka.value(return_value)
|
||||
|
||||
if actual != reference:
|
||||
return False
|
||||
except Exception as ex:
|
||||
context.log_error(ex)
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user