# testperson.py # Walker M. White (wmw2) # October 15, 2015 """Unit test for Person class.""" import cornelltest import person def build_test_tree(): """Returns: Youngest generation Person in a complete family tree Creates a genealogical tree for testing""" # GREAT GRANDPARENTS (some unknown) # John Smith Sr. ggd1 = person.Person('John', 'Smith') ggm1 = person.Person('Pamela', 'Grey') #gggm1 = person.Person('Geraldine', 'Miller') #ggm2 = person.Person('Eva', 'Rogers', gggm1, None) ggm2 = person.Person('Eva', 'Rogers') ggd4 = person.Person('Dan', 'O\'Reilly') ggm4 = person.Person('Heather', 'Chase') # GRANDPARENTS # John Smith Jr. gd1 = person.Person('John','Smith',ggm1,ggd1) gm1 = person.Person('Jane','Dare',ggm2,None) gd2 = person.Person('John','Evans') gm2 = person.Person('Ellen','O\'Reilly',ggd4,ggm4) # PARENTS # John Smith III d = person.Person('John','Smith',gm1,gd1) m = person.Person('Pamela','Evans',gm2,gd2) # FINAL GENERATION # John Smith IV p = person.Person('John','Smith',m,d) return p # Script Code p = build_test_tree() print person.num_ancestors(p) print person.all_ancestors(p) print person.greatest_grandparent(p)