diff --git a/midv500/utils.py b/midv500/utils.py index 8081dd2..2c7a886 100644 --- a/midv500/utils.py +++ b/midv500/utils.py @@ -88,7 +88,7 @@ def list_annotation_paths_recursively(directory: str, ignore_background_only_one abs_filepath = abs_filepath.replace("\\", "/") # for windows relative_filepath = abs_filepath.split(directory)[-1] # get relative path from abs path - relative_filepath = [relative_filepath[1:] if relative_filepath[0] == "/" else relative_filepath] + relative_filepath = [relative_filepath[1:] if relative_filepath[0] == "/" else relative_filepath][0] relative_filepath_list.append(relative_filepath) number_of_files = len(relative_filepath_list) diff --git a/tests/test_unit.py b/tests/test_unit.py index 0cfdf87..a3307ca 100644 --- a/tests/test_unit.py +++ b/tests/test_unit.py @@ -43,6 +43,7 @@ def test_list_annotation_paths_recursively(self): # read annotations paths annotation_paths = list_annotation_paths_recursively(directory, ignore_background_only_ones=True) self.assertEqual(len(annotation_paths), 90) + self.assertEqual(annotation_paths[3], '01_alb_id/ground_truth/HA/HA01_04.json') def test_download(self): from midv500.utils import download