예제 #1
0
 def test_calc_age_returns_none_if_date_of_death_missing(self):
     examination_overview = ExaminationOverview(
         ExaminationMocks.get_case_index_response_content()['examinations']
         [0])
     birth_date = '2019-02-02T02:02:02.000Z'
     examination_overview.date_of_birth = parse_datetime(birth_date)
     examination_overview.date_of_death = None
     result = examination_overview.calc_age()
     self.assertIsNone(result)
예제 #2
0
    def test_calc_age_returns_none_if__both_dates_missing(self):
        examination_overview = ExaminationOverview(
            ExaminationMocks.get_case_index_response_content()['examinations']
            [0])
        examination_overview.date_of_birth = None
        examination_overview.date_of_death = None
        result = examination_overview.calc_age()

        self.assertIsNone(result)
예제 #3
0
 def test_calc_age_correctly_calculates_the_age_if_dates_present(self):
     examination_overview = ExaminationOverview(
         ExaminationMocks.get_case_index_response_content()['examinations']
         [0])
     birth_date = '2018-02-02T02:02:02.000Z'
     death_date = '2019-02-02T02:02:02.000Z'
     examination_overview.date_of_birth = parse_datetime(birth_date)
     examination_overview.date_of_death = parse_datetime(death_date)
     result = examination_overview.calc_age()
     expected_age = 1
     self.assertEqual(result, expected_age)