def setup(self):
     self.n = impl.Network()
     self.p1 = self.n.create_person()
     self.p2 = self.n.create_person()
     self.p3 = self.n.create_person()
     self.n.add_person_property(self.p1, 'name', 'Zach')
     self.n.add_person_property(self.p2, 'name', 'Erin')
 def __init__(self):
     self.n = impl.Network()
     self.p1 = self.n.create_person()
     self.p2 = self.n.create_person()
     self.p3 = self.n.create_person()
     self.r1 = self.n.add_relation(self.p1, self.p2)
     self.r2 = self.n.add_relation(self.p2, self.p3)
     self.r3 = self.n.add_relation(self.p3, self.p3)
 def test_raises_if_person_not_in_network(self):
     # asserts that RuntimeError is raised if the given person is not found in the Network
     try:
         self.setup()
         temp = impl.Network()
         p = temp.create_person()
         p.id = -1
         self.n.add_person_property(p, 'name', 'Fred')
     except RuntimeError:
         assert True
     except:
         assert False
 def test_raises_if_person2_not_exists(self):
     # asserts that a RuntimeError is raised if person2 is not in the network
     try:
         self.setup()
         tempNetwork = impl.Network()
         p = tempNetwork.create_person()
         p.id = -1
         self.n.add_relation(self.p1, p)
         assert False
     except RuntimeError:
         assert True
     except:
         assert False
    def setup(self):
        self.n = impl.Network()
        self.p1 = self.n.create_person()
        self.p2 = self.n.create_person()
        self.p3 = self.n.create_person()
        self.p4 = self.n.create_person()
        self.n.add_person_property(self.p1, 'name', 'p1')
        self.n.add_person_property(self.p2, 'name', 'p2')
        self.n.add_person_property(self.p3, 'name', 'p3')
        self.n.add_person_property(self.p4, 'name', 'p4')

        # p1 is friends with p2, p3, p4
        self.n.add_relation(self.p1, self.p2)
        self.n.add_relation_property(self.p1, self.p2, 'friend', True)
        self.n.add_relation(self.p1, self.p3)
        self.n.add_relation_property(self.p1, self.p3, 'friend', True)
        self.n.add_relation(self.p1, self.p4)
        self.n.add_relation_property(self.p1, self.p4, 'friend', True)

        # p2 is friends with p1, p3
        # self.n.add_relation(self.p2, self.p1)
        # self.n.add_relation_property(self.p2, self.p1, 'friend', True)
        self.n.add_relation(self.p2, self.p3)
        self.n.add_relation_property(self.p2, self.p3, 'friend', True)
 def __init__(self):
     self.n = impl.Network()
     self.p1 = self.n.create_person()
     self.p2 = self.n.create_person()
     self.p3 = self.n.create_person()
 def setup(self):
     self.n = impl.Network()
     self.p1 = self.n.create_person()
     self.p2 = self.n.create_person()
     self.n.add_person_property(self.p1, 'name', 'foo')
     self.n.add_person_property(self.p2, 'name', 'bar')
 def setup_method(self, method):
     self.network = impl.Network()
Beispiel #9
0
 def test_add_relation_non_existent_persons3(self):
     p1 = self.network.create_person()
     p2 = impl.Network().create_person()
     with pytest.raises(RuntimeError, message="add_relation does not fail when adding relation between non-existent persons"):
         self.network.add_relation(p1, p2)
Beispiel #10
0
 def setup_method(self):
     self.nw = impl.Network()