Commit 099ef01e authored by André Anjos's avatar André Anjos 💬

Merge branch 'tests_improvements' into 'master'

Tests improvements

See merge request !95
parents 05b2b084 321f2c76
Pipeline #33610 failed with stages
in 19 minutes and 14 seconds
......@@ -42,12 +42,9 @@ class Algorithm:
self.output = None
def validate(self, result):
print("We are validating")
value = result.value[0]
self.output = value
return (True, {"value": np.float32(value)})
def write(self, outputs, end_data_index):
print("block input loop writing", outputs, end_data_index)
outputs["out_loop"].write({"value": np.int32(self.output)}, end_data_index)
print("block input loop writing done")
......@@ -47,8 +47,5 @@ class Algorithm:
value = data["in"].value
_, validated = loop_channel.validate({"value": np.full(10, 12)})
new_value = value + validated.value
print("BLOCK INPUT LOOP USER VALUE IS", value)
print("BLOCK INPUT LOOP USER WRITING NEW VALUE", new_value)
outputs["out"].write({"value": np.int32(new_value)}, end)
print("BLOCK INPUT LOOP USER WRITING DONE")
return True
......@@ -56,6 +56,9 @@ class Algorithm:
value = data["in_loop"].value
self.max += value
if abs(self.max - self.threshold) <= 1:
self.max = self.threshold + 2
return True
def validate(self, result):
......
......@@ -17,7 +17,7 @@
"evaluator_algorithm": "user/db_input_loop_evaluator/1",
"evaluator_parameters": {
"threshold": 1
"threshold": 9
},
"evaluator_inputs": {
"in_loop": "in_loop"
......
......@@ -349,7 +349,7 @@ class BaseExecutionMixIn(object):
def test_loop_1(self):
nose.tools.assert_is_none(
self.execute(
"user/user/loop/1/loop", [{"sum": 504, "nb": 9}, {"sum": 72, "nb": 9}]
"user/user/loop/1/loop", [{"sum": 135, "nb": 9}, {"sum": 9, "nb": 9}]
)
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment