Пример #1
0
 def test_node_degree(self):
     alice = Node("Person", name="Alice")
     bob = Node("Person", name="Bob")
     carol = Node("Person", name="Carol")
     self.graph.create(alice)
     assert alice.degree() == 0
     self.graph.create(Path(alice, "KNOWS", bob))
     assert alice.degree() == 1
     self.graph.create(Path(alice, "KNOWS", carol))
     assert alice.degree() == 2
     self.graph.create(Path(carol, "KNOWS", alice))
     assert alice.degree() == 3