def test_year_formated(self): ''' Test formatted year output ''' assert(formated_year(2016, "EXACT") == "2016") assert(formated_year(2016, "ABOUT") == "ca 2016") assert(formated_year("2016", "AFTER") == "aft. 2016") assert(formated_year(2016, "BEFORE") == "bef. 2016")
def nameLifespan(self): ''' Function for printing an standard format of naming ''' year_birth = "?" if("birth" in self.gen_data.keys()): year_birth = formated_year(self.gen_data["birth"].get_year(), self.gen_data["birth"].get_accuracy()) year_death = "?" if("death" in self.gen_data.keys()): year_death = formated_year(self.gen_data["death"].get_year(), self.gen_data["death"].get_accuracy()) if (year_birth == "?") and (year_death == "?"): return self.getName2Show() else: return self.getName2Show() + " (" + year_birth + " - " + year_death + ")"
def nameLifespan(self): ''' Function for printing an standard format of naming ''' all_events = self.getEvents() dict_events = {} for event in all_events: dict_events[event.get_event_type()] = event year_birth = "?" if ("birth" in dict_events.keys() and (dict_events["birth"].get_year() is not None)): year_birth = formated_year(dict_events["birth"].get_year(), dict_events["birth"].get_accuracy()) year_death = "?" if ("death" in dict_events.keys() and (dict_events["death"].get_year() is not None)): year_death = formated_year(dict_events["death"].get_year(), dict_events["death"].get_accuracy()) if (year_birth == "?") and (year_death == "?"): return self.getName2Show() else: return self.getName2Show( ) + " (" + year_birth + " - " + year_death + ")"