Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.core
Commits
062fbe8a
Commit
062fbe8a
authored
6 years ago
by
Samuel GAIST
Browse files
Options
Downloads
Patches
Plain Diff
[test][toolchain_invalid] Code cleanup
parent
9ba28903
No related branches found
No related tags found
1 merge request
!62
Code cleanup
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/core/test/test_toolchain_invalid.py
+20
-18
20 additions, 18 deletions
beat/core/test/test_toolchain_invalid.py
with
20 additions
and
18 deletions
beat/core/test/test_toolchain_invalid.py
+
20
−
18
View file @
062fbe8a
...
@@ -48,48 +48,50 @@ def count_errors(l, e):
...
@@ -48,48 +48,50 @@ def count_errors(l, e):
def
test_load_default
():
def
test_load_default
():
toolchain
=
Toolchain
(
prefix
,
data
=
None
)
toolchain
=
Toolchain
(
prefix
,
data
=
None
)
assert
toolchain
.
valid
,
"
\n
* %s
"
%
"
\n
*
"
.
join
(
toolchain
.
errors
)
nose
.
tools
.
assert_true
(
toolchain
.
valid
,
"
\n
* %s
"
%
"
\n
*
"
.
join
(
toolchain
.
errors
)
)
def
test_load_unknown_toolchain
():
def
test_load_unknown_toolchain
():
toolchain
=
Toolchain
(
prefix
,
"
user/unknown/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/unknown/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"
file not found
"
),
1
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"
file not found
"
),
1
)
def
test_load_invalid_toolchain
():
def
test_load_invalid_toolchain
():
toolchain
=
Toolchain
(
prefix
,
"
user/invalid/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/invalid/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"
invalid JSON
"
),
1
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"
invalid JSON
"
),
1
)
def
test_load_toolchain_without_blocks_list
():
def
test_load_toolchain_without_blocks_list
():
toolchain
=
Toolchain
(
prefix
,
"
user/missing_blocks/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/missing_blocks/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
blocks
'
is a required property
"
),
1
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
blocks
'
is a required property
"
),
1
)
def
test_load_toolchain_with_missing_block_name
():
def
test_load_toolchain_with_missing_block_name
():
toolchain
=
Toolchain
(
prefix
,
"
user/missing_block_name/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/missing_block_name/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
name
'
is a required property
"
),
1
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
name
'
is a required property
"
),
1
)
def
test_load_toolchain_with_missing_block_inputs
():
def
test_load_toolchain_with_missing_block_inputs
():
toolchain
=
Toolchain
(
prefix
,
"
user/missing_block_inputs/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/missing_block_inputs/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
inputs
'
is a required property
"
),
1
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
inputs
'
is a required property
"
),
1
)
def
test_load_toolchain_with_missing_block_outputs
():
def
test_load_toolchain_with_missing_block_outputs
():
toolchain
=
Toolchain
(
prefix
,
"
user/missing_block_outputs/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/missing_block_outputs/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
outputs
'
is a required property
"
),
1
count_errors
(
toolchain
.
errors
,
"'
outputs
'
is a required property
"
),
1
)
)
...
@@ -98,7 +100,7 @@ def test_load_toolchain_with_missing_block_outputs():
...
@@ -98,7 +100,7 @@ def test_load_toolchain_with_missing_block_outputs():
def
test_load_toolchain_without_datasets_list
():
def
test_load_toolchain_without_datasets_list
():
toolchain
=
Toolchain
(
prefix
,
"
user/missing_datasets/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/missing_datasets/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
datasets
'
is a required property
"
),
1
count_errors
(
toolchain
.
errors
,
"'
datasets
'
is a required property
"
),
1
)
)
...
@@ -107,14 +109,14 @@ def test_load_toolchain_without_datasets_list():
...
@@ -107,14 +109,14 @@ def test_load_toolchain_without_datasets_list():
def
test_load_toolchain_with_missing_dataset_name
():
def
test_load_toolchain_with_missing_dataset_name
():
toolchain
=
Toolchain
(
prefix
,
"
user/missing_dataset_name/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/missing_dataset_name/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
name
'
is a required property
"
),
1
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
name
'
is a required property
"
),
1
)
def
test_load_toolchain_with_missing_dataset_outputs
():
def
test_load_toolchain_with_missing_dataset_outputs
():
toolchain
=
Toolchain
(
prefix
,
"
user/missing_dataset_outputs/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/missing_dataset_outputs/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
outputs
'
is a required property
"
),
1
count_errors
(
toolchain
.
errors
,
"'
outputs
'
is a required property
"
),
1
)
)
...
@@ -123,21 +125,21 @@ def test_load_toolchain_with_missing_dataset_outputs():
...
@@ -123,21 +125,21 @@ def test_load_toolchain_with_missing_dataset_outputs():
def
test_load_toolchain_with_missing_connection_from
():
def
test_load_toolchain_with_missing_connection_from
():
toolchain
=
Toolchain
(
prefix
,
"
user/missing_connection_from/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/missing_connection_from/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
from
'
is a required property
"
),
1
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
from
'
is a required property
"
),
1
)
def
test_load_toolchain_with_missing_connection_to
():
def
test_load_toolchain_with_missing_connection_to
():
toolchain
=
Toolchain
(
prefix
,
"
user/missing_connection_to/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/missing_connection_to/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
to
'
is a required property
"
),
1
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"'
to
'
is a required property
"
),
1
)
def
test_load_toolchain_referencing_unknown_block_input
():
def
test_load_toolchain_referencing_unknown_block_input
():
toolchain
=
Toolchain
(
prefix
,
"
user/unknown_block_input/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/unknown_block_input/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"
invalid input endpoint
'
addition.c
'"
),
1
count_errors
(
toolchain
.
errors
,
"
invalid input endpoint
'
addition.c
'"
),
1
)
)
...
@@ -146,7 +148,7 @@ def test_load_toolchain_referencing_unknown_block_input():
...
@@ -146,7 +148,7 @@ def test_load_toolchain_referencing_unknown_block_input():
def
test_load_toolchain_referencing_unknown_dataset_output
():
def
test_load_toolchain_referencing_unknown_dataset_output
():
toolchain
=
Toolchain
(
prefix
,
"
user/unknown_dataset_output/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/unknown_dataset_output/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"
invalid output endpoint
'
integers.timestamps
'"
),
count_errors
(
toolchain
.
errors
,
"
invalid output endpoint
'
integers.timestamps
'"
),
1
,
1
,
...
@@ -156,7 +158,7 @@ def test_load_toolchain_referencing_unknown_dataset_output():
...
@@ -156,7 +158,7 @@ def test_load_toolchain_referencing_unknown_dataset_output():
def
test_load_toolchain_referencing_unknown_block_output
():
def
test_load_toolchain_referencing_unknown_block_output
():
toolchain
=
Toolchain
(
prefix
,
"
user/unknown_block_output/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/unknown_block_output/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"
invalid output endpoint
'
addition.unknown
'"
),
1
count_errors
(
toolchain
.
errors
,
"
invalid output endpoint
'
addition.unknown
'"
),
1
)
)
...
@@ -165,7 +167,7 @@ def test_load_toolchain_referencing_unknown_block_output():
...
@@ -165,7 +167,7 @@ def test_load_toolchain_referencing_unknown_block_output():
def
test_load_toolchain_referencing_unknown_analyzer_input
():
def
test_load_toolchain_referencing_unknown_analyzer_input
():
toolchain
=
Toolchain
(
prefix
,
"
user/unknown_analyzer_input/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/unknown_analyzer_input/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"
invalid input endpoint
'
analysis.unknown
'"
),
1
count_errors
(
toolchain
.
errors
,
"
invalid input endpoint
'
analysis.unknown
'"
),
1
)
)
...
@@ -174,7 +176,7 @@ def test_load_toolchain_referencing_unknown_analyzer_input():
...
@@ -174,7 +176,7 @@ def test_load_toolchain_referencing_unknown_analyzer_input():
def
test_load_toolchain_unconnected_input
():
def
test_load_toolchain_unconnected_input
():
toolchain
=
Toolchain
(
prefix
,
"
user/unconnected_input/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/unconnected_input/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"
input(s) `addition.b
'
remain unconnected
"
),
1
count_errors
(
toolchain
.
errors
,
"
input(s) `addition.b
'
remain unconnected
"
),
1
)
)
...
@@ -183,5 +185,5 @@ def test_load_toolchain_unconnected_input():
...
@@ -183,5 +185,5 @@ def test_load_toolchain_unconnected_input():
def
test_load_toolchain_double_connected_input
():
def
test_load_toolchain_double_connected_input
():
toolchain
=
Toolchain
(
prefix
,
"
user/double_connected_input/1
"
)
toolchain
=
Toolchain
(
prefix
,
"
user/double_connected_input/1
"
)
assert
toolchain
.
valid
is
False
nose
.
tools
.
assert_false
(
toolchain
.
valid
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"
ending on the same input as
"
),
1
)
nose
.
tools
.
eq_
(
count_errors
(
toolchain
.
errors
,
"
ending on the same input as
"
),
1
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment