diff --git a/lib/AssemblyUtil/FastaToAssembly.py b/lib/AssemblyUtil/FastaToAssembly.py index 3ffa54e..25b39b8 100644 --- a/lib/AssemblyUtil/FastaToAssembly.py +++ b/lib/AssemblyUtil/FastaToAssembly.py @@ -484,9 +484,9 @@ def _validate_mass_params(self, params): # validate object_metadata is a mapping if provided obj_metas = [i.get(_OBJ_META) for i in inputs] - for obj_meta in obj_metas: + for i, obj_meta in enumerate(obj_metas, start=1): if obj_meta is not None and type(obj_meta) != dict: - raise ValueError(f"{_OBJ_META} must be a mapping if provided") + raise ValueError(f"{_OBJ_META} must be a mapping if provided for entry #{i}") def _get_int(self, putative_int, name, minimum=1): if putative_int is not None: diff --git a/test/FastaToAssembly_unit_test.py b/test/FastaToAssembly_unit_test.py index aa7a048..e25420c 100644 --- a/test/FastaToAssembly_unit_test.py +++ b/test/FastaToAssembly_unit_test.py @@ -640,10 +640,12 @@ def test_import_fasta_mass_fail_min_contig_length(): def test_import_fasta_mass_fail_invalid_obj_meta(): - err1 = 'object_metadata must be a mapping if provided' + err1 = 'object_metadata must be a mapping if provided for entry #1' test_spec = [ (err1, {'workspace_id': 3, 'inputs': [{'node': 'a', 'assembly_name': 'x', 'object_metadata': 'foo'}]}), + (err1, + {'workspace_id': 3, 'inputs': [{'node': 'a', 'assembly_name': 'x', 'object_metadata': []}]}) ] _run_test_spec_fail(test_spec, mass=True)