Commit 6a107423 authored by Gabriel Couture's avatar Gabriel Couture

Update Unit tests

parent 241409a2
Pipeline #180 passed with stage
in 4 seconds
......@@ -2,7 +2,7 @@
# author: gabriel couture
import unittest
from copy import deepcopy
from unittest.mock import Mock
from unittest.mock import Mock, patch
from dvh import conversion
......@@ -33,6 +33,19 @@ class TestConversion(unittest.TestCase):
self.assertEqual(result, AN_ABSOLUTE_DOSE_LIST)
def test_givenADVHWithAPrescriptionDose_whenCheckingIfDVHHasAPrescriptionDose_thenResultIsTrue(self):
self.a_dvh_with_absolute_doses.get_prescription_dose.return_value = A_PRESCRIPTION_DOSE
result = conversion.is_dvh_has_a_prescription_dose(self.a_dvh_with_absolute_doses)
self.assertTrue(result)
def test_givenADVH_whenCheckingIfDVHHasAPrescriptionDose_thenResultIsTrue(self):
result = conversion.is_dvh_has_a_prescription_dose(self.a_dvh_with_absolute_doses)
self.assertFalse(result)
@patch('dvh.conversion.convert_absolute_doses_to_relative', lambda doses, p_dose: A_RELATIVE_DOSE_LIST)
def test_givenADVHWithAbsoluteDosesAndPrescriptionDose_whenConvertingDVHDoseToRelative_thenResultIsADVHWithRelativeDoses(self):
self.a_dvh_with_absolute_doses.get_prescription_dose.return_value = A_PRESCRIPTION_DOSE
......@@ -53,6 +66,7 @@ class TestConversion(unittest.TestCase):
self.assertEqual(result.doses, A_RELATIVE_DOSE_LIST)
self.a_dvh_with_relative_doses.get_prescription_dose.assert_not_called()
@patch('dvh.conversion.convert_relative_doses_to_absolute', lambda doses, p_dose: AN_ABSOLUTE_DOSE_LIST)
def test_givenADVHWithRelativeDosesAndPrescriptionDose_whenConvertingDVHDoseToAbsolute_thenResultIsADVHWithAbsoluteDoses(self):
self.a_dvh_with_relative_doses.get_prescription_dose.return_value = A_PRESCRIPTION_DOSE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment