maternal_grandfather_brother_mate, sex = Sex.Male) maternal_grandfather_brother_son_mate = Node(sex = Sex.Female) father = Node(paternal_grandfather, paternal_grandmother, sex = Sex.Male) parent_generation = Generation([mother, father, maternal_uncle, maternal_uncle_mate, maternal_grandfather_brother_son, maternal_grandfather_brother_son_mate]) child = Node(father, mother) cousin = Node(maternal_uncle, maternal_uncle_mate) second_cousin = Node(maternal_grandfather_brother_son, maternal_grandfather_brother_son_mate) current_generation = Generation([child, cousin, second_cousin]) population._generations = [greatgrandparent_generation, grandparent_generation, parent_generation, current_generation] kinship = population.kinship_coefficients def test_kinship(person_1, person_2, expected): key = (person_1, person_2) assert kinship[key] == expected, ERROR_STRING.format(expected, kinship[key]) test_kinship(child, mother, 0.25) test_kinship(child, father, 0.25) test_kinship(child, maternal_grandfather, 1/8) test_kinship(child, paternal_grandfather, 1/8) test_kinship(child, maternal_grandmother, 1/8) test_kinship(child, paternal_grandmother, 1/8) test_kinship(child, maternal_uncle, 1/8)