Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.backend.python
Commits
4f9f3157
Commit
4f9f3157
authored
Jul 11, 2019
by
Samuel GAIST
Browse files
[test][algorithm] Add loop/loop_user loading tests
parent
94515dfa
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/backend/python/test/test_algorithm.py
View file @
4f9f3157
...
...
@@ -325,6 +325,56 @@ class TestAutonomousAPI_Loading(unittest.TestCase):
# ----------------------------------------------------------
class
TestLoopAPI_Loading
(
unittest
.
TestCase
):
def
test_load_valid_algorithm
(
self
):
algorithm
=
Algorithm
(
prefix
,
"autonomous/loop/1"
)
self
.
assertEqual
(
algorithm
.
name
,
"autonomous/loop/1"
)
self
.
assertTrue
(
algorithm
.
valid
)
self
.
assertFalse
(
algorithm
.
errors
)
self
.
assertFalse
(
algorithm
.
results
)
# it is not an analyzer
self
.
assertTrue
(
algorithm
.
parameters
)
self
.
assertTrue
(
algorithm
.
input_map
)
self
.
assertTrue
(
algorithm
.
output_map
)
self
.
assertEqual
(
algorithm
.
schema_version
,
3
)
self
.
assertEqual
(
algorithm
.
api_version
,
2
)
self
.
assertEqual
(
algorithm
.
type
,
Algorithm
.
LOOP
)
runnable
=
algorithm
.
runner
()
self
.
assertFalse
(
runnable
.
ready
)
self
.
assertTrue
(
runnable
.
prepared
)
# loop/1 has no prepare method so is prepared
# ----------------------------------------------------------
class
TestLoopUserAPI_Loading
(
unittest
.
TestCase
):
def
test_load_valid_algorithm
(
self
):
algorithm
=
Algorithm
(
prefix
,
"autonomous/loop_user/1"
)
self
.
assertEqual
(
algorithm
.
name
,
"autonomous/loop_user/1"
)
self
.
assertTrue
(
algorithm
.
valid
)
self
.
assertFalse
(
algorithm
.
errors
)
self
.
assertFalse
(
algorithm
.
results
)
# it is not an analyzer
self
.
assertFalse
(
algorithm
.
parameters
)
# loop_user/1 has no parameter
self
.
assertTrue
(
algorithm
.
input_map
)
self
.
assertTrue
(
algorithm
.
output_map
)
self
.
assertEqual
(
algorithm
.
schema_version
,
3
)
self
.
assertEqual
(
algorithm
.
api_version
,
2
)
self
.
assertEqual
(
algorithm
.
type
,
Algorithm
.
AUTONOMOUS_LOOP_USER
)
runnable
=
algorithm
.
runner
()
self
.
assertTrue
(
runnable
.
ready
)
# loop_user/1 has no setup method so is ready
self
.
assertTrue
(
runnable
.
prepared
)
# loop/1 has no prepare method so is prepared
# ----------------------------------------------------------
class
TestLegacyAPI_Setup
(
unittest
.
TestCase
):
def
__init__
(
self
,
methodName
=
"runTest"
):
super
(
TestLegacyAPI_Setup
,
self
).
__init__
(
methodName
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment