def test_calculate_age(self): a_person = PersonFactory() a_person.birth_date = datetime.datetime.now() - datetime.timedelta( days=((30 * 365) + 15)) self.assertEqual(person.calculate_age(a_person), 30) a_person.birth_date = datetime.datetime.now() - datetime.timedelta( days=((30 * 365) - 5)) self.assertEqual(person.calculate_age(a_person), 29)
def construct_line(mandate): line = get_entities_for_mandate(mandate) line += [ mandate.sap_id, str(mandate.assistant.person.last_name), str(mandate.assistant.person.first_name), str(mandate.assistant.person.email), str(mandate.assistant.person.global_id), person.calculate_age(mandate.assistant.person), ] line += [ _(mandate.state), ] line += [ _(mandate.renewal_type), _(str(mandate.assistant_type)), mandate.fulltime_equivalent, mandate.contract_duration_fte, mandate.contract_duration, mandate.entry_date, mandate.end_date, mandate.comment, mandate.absences if mandate.absences != 'None' else '', ] line += get_reviews(mandate) return line