def test12(): p1 = Person() p1.events = [] p2 = Person() p2.events = [ Event(BIRTH, "exact", 2000), ] p1.children = [p2] p2.parents = [p1] persons = [p1, p2] calculate_estimates(persons) assert p1.birth_low == 1935 assert p1.birth_high == 1985 assert p1.death_low == 2000 assert p1.death_high == 2085
def test6(): p1 = Person() p1.events = [ Event(BIRTH, "exact", 1900), ] p2 = Person() p2.events = [] p1.children = [p2] p2.parents = [p1] persons = [p1, p2] calculate_estimates(persons) assert p2.birth_low == 1915 assert p2.birth_high == 1965 assert p2.death_low == 1915 assert p2.death_high == 2065
def test13j(): p1 = Person() p1.events = [] p2 = Person() p2.events = [ Event(BIRTH, "before", 1950), Event(DEATH, "before", 2000), ] p1.children = [p2] p2.parents = [p1] persons = [p1, p2] calculate_estimates(persons) assert p1.birth_low is MIN assert p1.birth_high == 1935 assert p1.death_low is MIN assert p1.death_high == 2035
def test13f(): p1 = Person() p1.events = [] p2 = Person() p2.events = [ Event(BIRTH, "after", 1950), Event(DEATH, "after", 2000), ] p1.children = [p2] p2.parents = [p1] persons = [p1, p2] calculate_estimates(persons) assert p1.birth_low == 1885 assert p1.birth_high is MAX assert p1.death_low == 1950 assert p1.death_high is MAX
def test5(): # p1 is a parent of p2 p1 = Person() p1.events = [ Event(BIRTH, "exact", 1900), Event(DEATH, "exact", 1950), ] p2 = Person() p2.events = [] p1.children = [p2] p2.parents = [p1] persons = [p1, p2] calculate_estimates(persons) assert p2.birth_low == 1915 assert p2.birth_high == 1950 assert p2.death_low == 1915 assert p2.death_high == 2050
def test0(): p1 = Person() p1.events = [] persons = [p1] calculate_estimates(persons) assert p1.birth_low is MIN assert p1.birth_high is MAX assert p1.death_low is MIN assert p1.death_high is MAX
def test_none(): p1 = Person() p1.events = [ Event(BIRTH, "exact", None), ] persons = [p1] calculate_estimates(persons) assert p1.birth_low is MIN assert p1.birth_high is MAX assert p1.death_low is MIN assert p1.death_high is MAX
def test4(): p1 = Person() p1.events = [ Event(DEATH, "exact", 1900), ] persons = [p1] calculate_estimates(persons) assert p1.birth_low == 1800 assert p1.birth_high == 1900 assert p1.death_low == 1900 assert p1.death_high == 1900
def test2(): p1 = Person() p1.events = [ Event("resi", "exact", 1950), ] persons = [p1] calculate_estimates(persons) assert p1.birth_low == 1850 assert p1.birth_high == 1950 assert p1.death_low == 1950 assert p1.death_high == 2050
def main(): p1 = Person() p1.events = [ # Event(BIRTH,"exact",1860), # Event(DEATH,"exact",1950), #Event("resi","exact",1950), #Event(MARRIAGE,"exact",1960), ] p2 = Person() p2.events = [ #Event("resi","exact",1900), # Event(MARRIAGE,"exact",1960), ] p3 = Person() p3.events = [ Event("resi", "exact", 1980), ] p1.parents = [p2] p3.parents = [p2] p1.children = [] p2.children = [p1, p3] calculate_estimates([p1, p2, p3]) print("p1") p = p1 print(f" birth: {p.birth_low}-{p.birth_high}") print(f" death: {p.death_low}-{p.death_high}") print("p2") p = p2 print(f" birth: {p.birth_low}-{p.birth_high}") print(f" death: {p.death_low}-{p.death_high}") print("p3") p = p3 print(f" birth: {p.birth_low}-{p.birth_high}") print(f" death: {p.death_low}-{p.death_high}")
def xtest14(): p1 = Person() p1.events = [ Event(BIRTH, "exact", 1950), Event(DEATH, "exact", 1940), ] persons = [p1] calculate_estimates(persons) assert p1.birth_low == 1950 assert p1.birth_high == 1950 assert p1.death_low == 1940 assert p1.death_high == 1940
def xtest(name, *events): return p = Person() p.events = events calculate_estimates(p) #print("birth_high=",p.birth_high) #print("death_high=",p.death_high) print(name) print(f" birth: {p.birth_low}-{p.birth_high}") print(f" death: {p.death_low}-{p.death_high}")
def test15(): p1 = Person() p2 = Person() p3 = Person() p3.events = [ Event(BIRTH, "exact", 1950), ] persons = [p1, p2, p3] p1.children = [p2] p2.children = [p3] p2.parents = [p1] p3.parents = [p2] calculate_estimates(persons) assert p1.birth_low == 1820 assert p1.birth_high == 1920 assert p1.death_low == 1885 assert p1.death_high == 2020