Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename warning #103

Merged
merged 2 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions toffy/rename_fovs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions toffy/rename_fovs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand Down