Commit 062fbe8a authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[test][toolchain_invalid] Code cleanup

parent 9ba28903
......@@ -48,48 +48,50 @@ def count_errors(l, e):
def test_load_default():
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():
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)
def test_load_invalid_toolchain():
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)
def test_load_toolchain_without_blocks_list():
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)
def test_load_toolchain_with_missing_block_name():
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)
def test_load_toolchain_with_missing_block_inputs():
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)
def test_load_toolchain_with_missing_block_outputs():
toolchain = Toolchain(prefix, "user/missing_block_outputs/1")
assert toolchain.valid is False
nose.tools.assert_false(toolchain.valid)
nose.tools.eq_(
count_errors(toolchain.errors, "'outputs' is a required property"), 1
)
......@@ -98,7 +100,7 @@ def test_load_toolchain_with_missing_block_outputs():
def test_load_toolchain_without_datasets_list():
toolchain = Toolchain(prefix, "user/missing_datasets/1")
assert toolchain.valid is False
nose.tools.assert_false(toolchain.valid)
nose.tools.eq_(
count_errors(toolchain.errors, "'datasets' is a required property"), 1
)
......@@ -107,14 +109,14 @@ def test_load_toolchain_without_datasets_list():
def test_load_toolchain_with_missing_dataset_name():
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)
def test_load_toolchain_with_missing_dataset_outputs():
toolchain = Toolchain(prefix, "user/missing_dataset_outputs/1")
assert toolchain.valid is False
nose.tools.assert_false(toolchain.valid)
nose.tools.eq_(
count_errors(toolchain.errors, "'outputs' is a required property"), 1
)
......@@ -123,21 +125,21 @@ def test_load_toolchain_with_missing_dataset_outputs():
def test_load_toolchain_with_missing_connection_from():
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)
def test_load_toolchain_with_missing_connection_to():
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)
def test_load_toolchain_referencing_unknown_block_input():
toolchain = Toolchain(prefix, "user/unknown_block_input/1")
assert toolchain.valid is False
nose.tools.assert_false(toolchain.valid)
nose.tools.eq_(
count_errors(toolchain.errors, "invalid input endpoint 'addition.c'"), 1
)
......@@ -146,7 +148,7 @@ def test_load_toolchain_referencing_unknown_block_input():
def test_load_toolchain_referencing_unknown_dataset_output():
toolchain = Toolchain(prefix, "user/unknown_dataset_output/1")
assert toolchain.valid is False
nose.tools.assert_false(toolchain.valid)
nose.tools.eq_(
count_errors(toolchain.errors, "invalid output endpoint 'integers.timestamps'"),
1,
......@@ -156,7 +158,7 @@ def test_load_toolchain_referencing_unknown_dataset_output():
def test_load_toolchain_referencing_unknown_block_output():
toolchain = Toolchain(prefix, "user/unknown_block_output/1")
assert toolchain.valid is False
nose.tools.assert_false(toolchain.valid)
nose.tools.eq_(
count_errors(toolchain.errors, "invalid output endpoint 'addition.unknown'"), 1
)
......@@ -165,7 +167,7 @@ def test_load_toolchain_referencing_unknown_block_output():
def test_load_toolchain_referencing_unknown_analyzer_input():
toolchain = Toolchain(prefix, "user/unknown_analyzer_input/1")
assert toolchain.valid is False
nose.tools.assert_false(toolchain.valid)
nose.tools.eq_(
count_errors(toolchain.errors, "invalid input endpoint 'analysis.unknown'"), 1
)
......@@ -174,7 +176,7 @@ def test_load_toolchain_referencing_unknown_analyzer_input():
def test_load_toolchain_unconnected_input():
toolchain = Toolchain(prefix, "user/unconnected_input/1")
assert toolchain.valid is False
nose.tools.assert_false(toolchain.valid)
nose.tools.eq_(
count_errors(toolchain.errors, "input(s) `addition.b' remain unconnected"), 1
)
......@@ -183,5 +185,5 @@ def test_load_toolchain_unconnected_input():
def test_load_toolchain_double_connected_input():
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)
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