Example #1
0
def tuplesToRelations(tupleList):
    ret = set()
    for tup in tupleList:
        rel = Relation(Person([tup[0]]), convertRelation(tup[1]),
                       Person([tup[2]]))
        ret.add(rel)
    return ret
Example #2
0
 def test_descendants_several(self):
     self.bob.children = [Person('Ed'), Person('Danielle')]
     fred = Person('Fred')
     gerry = Person('Gerry')
     holly = Person('Holly')
     ian = Person('Ian')
     self.charlie.children = [fred]
     fred.children = [gerry]
     gerry.children = [holly]
     self.assertEqual(self.alice.count_descendants(), 7)
Example #3
0
'''
Created on Nov 25, 2012

@author: Karl
'''

from family import Person, Parent, Child, Sibling, Spouse

JOHN = Person(["John X. Smith"], ["John"], Person.MALE)
ANNE = Person(["Anne Smith"], ["Anne"], Person.FEMALE)
PETE = Person(["Pete"], [], Person.MALE)
BOB = Person(["Bob"], [], Person.MALE)
SUE = Person(["Sue"], [], Person.FEMALE)
ROBERT = Person(["Robert"], [], Person.MALE)
ANNA = Person(["Anna"], [], Person.FEMALE)
HANNAH = Person(["Hannah"], [], Person.FEMALE)
SAVANNAH = Person(["Savannah"], [], Person.FEMALE)
KEN = Person(["Ken Torse"], ["Ken"], Person.MALE)
JANE = Person(["Jane"], [], Person.FEMALE)
JOSEPH = Person(["Joseph"], [], Person.MALE)
JAKE = Person(["Jake"], [], Person.MALE)
JAMES = Person(["James"], [], Person.MALE)

FAMILY = [
    Sibling(JOHN, JOSEPH),
    Sibling(JOHN, JAKE),
    Sibling(JOHN, JAMES),
    Sibling(JOHN, JANE),
    Parent(ANNE, JOHN),
    Parent(PETE, JOHN),
    Sibling(PETE, ANNA),
Example #4
0
from family import Person

p = Person(1, "Julien", [12, 24, 1980], "Male", "Blue")
p.last_name = "Dupont"
print "%s has %d years old" % (p, p.age())

p2 = Person(2, "Marc", [2, 4, 1986], "Male", "Green")
p2.last_name = "Zuckerberg"

if p > p2:
        print "%s is older than %s" % (p, p2)
else:
        print "%s is younger than %s" % (p, p2)
Example #5
0
    def setUp(self):
        self.alice = Person('Alice')
        self.bob = Person('Bob')
        self.charlie = Person('Charlie')

        self.alice.children = [self.bob, self.charlie]
from family import Person

p = Person(1, "Julien", [12, 24, 1980], "Male", "Blue")
p.last_name = "Dupont"
print "New person %s %s" % (p.get_first_name(), p.last_name)