Commit a7b0b36a authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test] Add test for loop experiment

parent 475c76ff
{
"schema_version": 2,
"blocks": {
"loop_user": {
"algorithm": "autonomous/loop_user/1",
"parameters": {
},
"inputs": {
"in": "in"
},
"outputs": {
"out": "out"
}
}
},
"loops": {
"test_loop": {
"algorithm": "autonomous/loop/1",
"parameters": {
"threshold": 1
},
"inputs": {
"in": "in"
}
}
},
"analyzers": {
"analysis": {
"algorithm": "user/integers_analysis/1",
"parameters": {
},
"inputs": {
"input": "input"
}
}
},
"datasets": {
"integers": {
"database": "integers_db/1",
"protocol": "double",
"set": "double"
}
},
"globals": {
"environment": {
"name": "Python 2.7",
"version": "1.3.0"
},
"queue": "queue"
}
}
{
"schema_version": 2,
"connections": [
{
"from": "integers.a",
"to": "loop_user.in",
"channel": "integers"
},
{
"from": "integers.b",
"to": "test_loop.in",
"channel": "integers"
},
{
"from": "loop_user.out",
"to": "analysis.input",
"channel": "integers"
}
],
"loop_connections": [
{
"from": "loop_user.request",
"to": "test_loop.request"
},
{
"from": "test_loop.answer",
"to": "loop_user.answer"
}
],
"datasets": [
{
"outputs": [
"a",
"b"
],
"name": "integers"
}
],
"blocks": [
{
"name": "loop_user",
"synchronized_channel": "integers",
"inputs": [
"in"
],
"outputs": [
"out"
]
}
],
"loops": [
{
"name": "test_loop",
"synchronized_channel": "integers",
"inputs": [
"in"
]
}
],
"analyzers": [
{
"inputs": [
"input"
],
"synchronized_channel": "integers",
"name": "analysis"
}
],
"representation": {
"connections": {
},
"loop_connections": {
},
"blocks": {
},
"channel_colors": {
"integers": "#5555ff"
}
}
}
......@@ -156,9 +156,11 @@ class BaseExecutionMixIn(object):
# compares all results
assert results
for k, result in enumerate(results):
expected = result.__class__()
expected.from_dict(expected_result[k], casting='unsafe') #defaults=False
assert result.isclose(expected), "%r is not close enough to %r" % (result.as_dict(), expected.as_dict())
......@@ -276,6 +278,9 @@ class BaseExecutionMixIn(object):
def test_single_1_prepare_success(self):
assert self.execute('user/user/single/1/prepare_success', [{'out_data': 42}]) is None
@slow
def test_loop_1(self):
assert self.execute('user/user/loop/1/loop', [{'sum': 45, 'nb': 9}]) is None
# For benchmark purposes
# @slow
......@@ -329,7 +334,6 @@ class TestSubprocessExecution(BaseExecutionMixIn):
return SubprocessExecutor(prefix, configuration, tmp_prefix,
dataformat_cache, database_cache, algorithm_cache)
@slow
def test_single_1_prepare_error(self):
result = self.execute('user/user/single/1/prepare_error', [None])
......
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