From e36bc0fee5df756f103f4bc8e5171bd700d26d89 Mon Sep 17 00:00:00 2001 From: Cami PC Date: Fri, 6 May 2022 15:53:44 -0700 Subject: [PATCH 1/2] add warning to verify_in_list --- toffy/rename_fovs.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/toffy/rename_fovs.py b/toffy/rename_fovs.py index c3c6c928..da5a136d 100644 --- a/toffy/rename_fovs.py +++ b/toffy/rename_fovs.py @@ -62,12 +62,9 @@ def rename_fov_dirs(run_path, fov_dir, new_dir=None): raise ValueError(f"All FOV folders in {fov_dir} have already been renamed") # check if custom fov names & scan counts match the number of existing default directories - try: - verify_in_list(default=list(fov_scan.keys()), existing_folders=old_dirs) - except ValueError: - warnings.warn(f"Not all FOVs specified in {run_path} have an existing directory") - - verify_in_list(existing_folders_not_found_in_run_file=old_dirs, default=list(fov_scan.keys())) + verify_in_list(warn=True, fovs_in_run_file=list(fov_scan.keys()), + existing_fov_folders=old_dirs) + verify_in_list(existing_fov_folders=old_dirs, fovs_in_run_file=list(fov_scan.keys())) # validate new_dir and copy contents of fov_dir if new_dir is not None: From 5e3c702fe22fc421606dafc67243feb2c6e53d31 Mon Sep 17 00:00:00 2001 From: Cami PC Date: Fri, 6 May 2022 15:57:30 -0700 Subject: [PATCH 2/2] edit test error string matching --- toffy/rename_fovs_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toffy/rename_fovs_test.py b/toffy/rename_fovs_test.py index f8144c03..3a11fc7b 100644 --- a/toffy/rename_fovs_test.py +++ b/toffy/rename_fovs_test.py @@ -82,7 +82,7 @@ def test_rename_fov_dirs(): create_sample_fov_dirs(less_fovs, fov_dir) # fovs in rule file without an existing dir should raise an error - with pytest.warns(UserWarning, match="Not all FOVs"): + with pytest.warns(UserWarning, match="Not all values"): rf.rename_fov_dirs(ex_run_path, fov_dir) remove_fov_dirs(fov_dir) @@ -92,7 +92,7 @@ def test_rename_fov_dirs(): create_sample_fov_dirs(extra_fovs, fov_dir) # extra dirs not listed in run file should raise an error - with pytest.raises(ValueError, match="not found in run file"): + with pytest.raises(ValueError, match="Not all values"): rf.rename_fov_dirs(ex_run_path, fov_dir) remove_fov_dirs(fov_dir)