From 5bd6cb4e34f63d8872a9535c21b3b07ee1d864b2 Mon Sep 17 00:00:00 2001 From: Kevin De Pelseneer Date: Tue, 12 Nov 2024 13:06:42 +0100 Subject: [PATCH] Check duplicated files --- mars-cli/mars_lib/isa_json.py | 6 +++--- mars-cli/tests/test_isa_json.py | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mars-cli/mars_lib/isa_json.py b/mars-cli/mars_lib/isa_json.py index 47239db..3ab0ad8 100644 --- a/mars-cli/mars_lib/isa_json.py +++ b/mars-cli/mars_lib/isa_json.py @@ -456,9 +456,9 @@ def map_data_files_to_repositories( Please correct the mismatch!""" ) else: - remaining_files.remove( - next(fd for fd in files_dicts if fd["short_name"] == adf) - ) + remaining_files = [ + fd for fd in remaining_files if fd["short_name"] != adf + ] df_map[target_repo_comment.value] = [ fd["full_name"] diff --git a/mars-cli/tests/test_isa_json.py b/mars-cli/tests/test_isa_json.py index aeab113..53ec88e 100644 --- a/mars-cli/tests/test_isa_json.py +++ b/mars-cli/tests/test_isa_json.py @@ -312,7 +312,7 @@ def test_map_data_files_to_repositories(): ): map_data_files_to_repositories(not_enough_files, isa_json) - too_many_files = exact_match_files + too_many_files = exact_match_files.copy() one_too_many = "../test-data/ISA-BH2024-ALL/one-too-many.fastq" too_many_files.append(one_too_many) @@ -321,3 +321,8 @@ def test_map_data_files_to_repositories(): assert one_too_many not in [ value for key, value_list in result_maps.items() for value in value_list ] + + duplicated_files = exact_match_files.copy() + duplicated_files.append(exact_match_files[-1]) + + map_data_files_to_repositories(duplicated_files, isa_json)