示例#1
0
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
示例#2
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
示例#3
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
示例#4
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
示例#5
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
示例#6
0
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}")
示例#7
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
示例#8
0
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
示例#9
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
示例#10
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
示例#11
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
示例#12
0
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
示例#13
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}")