Skip to content

Commit

Permalink
test: test output saving for matchCTtoSegmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
strixy16 committed Dec 19, 2023
1 parent a0b3336 commit 995726d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/test_metadata.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from yarea.metadata import *
import pytest
import os

@pytest.fixture
def nsclcSummaryFilePath():
Expand All @@ -9,6 +10,7 @@ def nsclcSummaryFilePath():
def lung4DSummaryFilePath():
return "tests/.imgtools/imgtools_4D-Lung.csv"


def test_matchCTtoSEG(nsclcSummaryFilePath):
"""Test generating matched summary file for CT and DICOM SEG"""
actual = matchCTtoSegmentation(nsclcSummaryFilePath,
Expand All @@ -21,7 +23,8 @@ def test_matchCTtoSEG(nsclcSummaryFilePath):
"Segmentation reference ID does not match CT series ID"
assert actual['modality_seg'][0] == 'SEG', \
"Incorrect segmentation type has been found"



def test_matchCTtoRTSTRUCT(lung4DSummaryFilePath):
"""Test generating matched summary file for CT and RTSTRUCT"""
actual = matchCTtoSegmentation(lung4DSummaryFilePath,
Expand All @@ -35,6 +38,17 @@ def test_matchCTtoRTSTRUCT(lung4DSummaryFilePath):
assert actual['modality_seg'][0] == 'RTSTRUCT', \
"Incorrect segmentation type has been found"


def test_matchCTtoSegmentation_output(nsclcSummaryFilePath):
"""Test saving output of summary file"""
actual = matchCTtoSegmentation(nsclcSummaryFilePath,
segType = "SEG",
outputDirPath = "tests/output/")
assert os.path.exists("tests/output/ct_to_seg_match_list_NSCLC_Radiogenomics.csv") == True, \
"Output does not exist, double check output file is named correctly."



@pytest.mark.parametrize(
"wrongSeg",
[
Expand All @@ -58,6 +72,7 @@ def test_saveDataframeCSV_outputFilePath_error(nsclcSummaryFilePath):
with pytest.raises(ValueError):
saveDataframeCSV(testDataframe, badFilePath)


@pytest.mark.parametrize(
"notADataFrame",
[
Expand Down

0 comments on commit 995726d

Please sign in to comment.