Example #1
0
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
Example #2
0
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
Example #3
0
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
Example #4
0
def test7():
    p1 = Person()
    p1.events = [
        Event(BIRTH, "exact", 1900),
        Event(DEATH, "exact", 1999),
    ]
    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
Example #5
0
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
Example #6
0
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
Example #7
0
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
Example #8
0
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
Example #9
0
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
Example #10
0
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}")