Skip to content

Commit

Permalink
test: 🧪 Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alanwilter committed Sep 11, 2024
1 parent 9ee91c1 commit d243813
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
10 changes: 3 additions & 7 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
fileignoreconfig:
- filename: poetry.lock
checksum: cd28f1624109b324f71193134fda3e5911a9a09b0a5eae6c051ad5a5fe8514c4
- filename: tests/test_main.py
checksum: 32b65cc89ae6fa4a65749ad4ee0caa968f23cbe1b496ba459ff0889c1b623204
- filename: tests/test_utils.py
checksum: ec76f44541d839e53b29168e29923d8c309720e53d7769da4b28eba7c1b7ce37
- filename: process_dcm/utils.py
checksum: 111741bfb41dd02c6fb8538bdf18baffbcb89c91e7714bc32d4ae0a8b2b607e3
- filename: README.md
checksum: ba2a6e5e3819c42a17ffb252a63f8841658eff651eab4915da0613f9d87debd5
checksum: a90ae4e646379b7626df33707759945bf62df2bd3e504ef82c9d1615d6dbb888
version: ""
File renamed without changes.
11 changes: 11 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ def test_main(md5, meta, keep, janitor, runner):
assert get_md5(of) in md5


def test_main_dummy(janitor, runner):
janitor.append("dummy_dir")
args = ["tests/dummy_ex", "-o", "dummy_dir", "-k", "p"]
result = runner.invoke(app, args)
assert result.exit_code == 0
of = sorted(glob("dummy_dir/**/*"))
assert len(of) == 2
assert get_md5("dummy_dir/dummy_ex/metadata.json") == "1cabdb14492a0e62d80cfc0a3fe304e9"
assert get_md5(of) in "b19bbfca59584915295f67e9259880d7"


def test_main_mapping(janitor, runner):
janitor.append("patient_2_study_id.csv")
with TemporaryDirectory() as tmpdirname:
Expand Down
4 changes: 3 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ def test_process_dcm(temp_output_dir, input_dir2, mocker):


def test_process_dcm_dummy(temp_output_dir):
new_patient_key, original_patient_key = process_dcm(input_dir="tests/", output_dir=temp_output_dir, overwrite=True)
new_patient_key, original_patient_key = process_dcm(
input_dir="tests/dummy_ex", output_dir=temp_output_dir, overwrite=True
)
assert new_patient_key, original_patient_key == ("2375458543", "123456")
assert get_md5(os.path.join(temp_output_dir, "metadata.json")) == "3ec329aacc807f470426d1b3706669fc"

0 comments on commit d243813

Please sign in to comment.