Skip to content

Commit

Permalink
♻️ DRY params, sub, scan
Browse files Browse the repository at this point in the history
  • Loading branch information
shnizzedy committed Jul 8, 2024
1 parent c5c39b0 commit 6a5b723
Show file tree
Hide file tree
Showing 2 changed files with 167 additions and 186 deletions.
12 changes: 4 additions & 8 deletions CPAC/utils/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from CPAC.utils.utils import (
check_config_resources,
check_system_deps,
fetch_and_convert,
ScanParameters,
)

SCAN_PARAMS = {
Expand Down Expand Up @@ -84,10 +84,8 @@ def test_fetch_and_convert(
caplog: LogCaptureFixture, scan_params: str, convert_to: type
) -> None:
"""Test functionality to fetch and convert scan parameters."""
params = SCAN_PARAMS[scan_params]["params"]
TR = fetch_and_convert(
scan_parameters=params,
scan="scan",
params = ScanParameters(SCAN_PARAMS[scan_params]["params"], "subject", "scan")
TR = params.fetch_and_convert(
keys=["TR", "RepetitionTime"],
convert_to=convert_to,
)
Expand All @@ -98,9 +96,7 @@ def test_fetch_and_convert(
assert "Using case-insenitive match: 'TR' ≅ 'tr'." in caplog.text
else:
assert "Using case-insenitive match: 'TR' ≅ 'tr'." not in caplog.text
not_TR = fetch_and_convert(
scan_parameters=params,
scan="scan",
not_TR = params.fetch_and_convert(
keys=["NotTR", "NotRepetitionTime"],
convert_to=convert_to,
)
Expand Down
Loading

0 comments on commit 6a5b723

Please sign in to comment.