예제 #1
0
def test_aunt_uncle(relation_test_fam: family_tree.Family):
    assert (relation_test_fam.relationship(
        "G1A", "G2C") == constants.RELATION_MATRIX[1][0])
예제 #2
0
def test_great_grandparent(relation_test_fam: family_tree.Family):
    assert relation_test_fam.relationship("G1A", "G4A") == "Great Grand-Parent"
예제 #3
0
def test_siblings(relation_test_fam: family_tree.Family):
    assert (relation_test_fam.relationship(
        "G1A", "G1B") == constants.RELATION_MATRIX[0][0])
예제 #4
0
def test_child(relation_test_fam: family_tree.Family):
    assert relation_test_fam.relationship("G2B", "G1A") == "Child"
예제 #5
0
def test_parental(relation_test_fam: family_tree.Family):
    assert relation_test_fam.relationship("G1A", "G2A") == "Parent"
예제 #6
0
def test_list_ancestors_layout(relation_test_fam: family_tree.Family):
    assert relation_test_fam.list_ancestors(relation_test_fam["G1A"]) == [
        {"G2B", "G2A"},
        {"G3B", "G3A", "G3C", "G3D"},
        {"G4A"},
    ]
예제 #7
0
def test_person_addition(my_test_fam: family_tree.Family):
    test_person = family_tree.Person("JD21990", "James Doe",
                                     datetime(1990, 1, 1))
    my_test_fam.add_person(test_person)
    assert len(my_test_fam) == 3
예제 #8
0
def test_no_duplicates(my_test_fam: family_tree.Family):
    my_test_fam.add_person(my_test_fam["JJ1996"])
    assert len(my_test_fam) == 2