コード例 #1
0
ファイル: graph_tests.py プロジェクト: pwoolcoc/Pylgrim
    def testFiltersOutE(self):
        """Make sure filters work with Edges, on the outE property"""
        t = Vertex(name="Frank")
        u = Vertex(name="Bob")
        v = Vertex(name="Sally")

        e1 = t.edgeto(u, weight=4, label="First Edge")
        e2 = t.edgeto(v, weight=5, label="Second Edge")

        results = t.outE(weight=5).label
        self.assertEqual(results, {'Second Edge'})
コード例 #2
0
ファイル: graph_tests.py プロジェクト: pwoolcoc/Pylgrim
    def testVertexEdgeToWithOtherProperties(self):
        """Make sure you can set other properties on the edge"""
        t = Vertex()
        u = Vertex()

        e = t.edgeto(u, weight=5, label="First Edge")
        self.assertEqual(e.label, "First Edge")
コード例 #3
0
ファイル: graph_tests.py プロジェクト: pwoolcoc/Pylgrim
    def testVertexEdgeToWithWeight(self):
        """Connect 2 Vertices with an edge, and give the edge a weight"""
        u = Vertex()
        v = Vertex()

        e = u.edgeto(v, weight=5)

        self.assertEqual(e.weight, 5)
コード例 #4
0
ファイル: graph_tests.py プロジェクト: pwoolcoc/Pylgrim
    def testVertexEdgeTo(self):
        """Connect 2 Vertices with an edge"""
        u = Vertex()
        v = Vertex()

        e = u.edgeto(v)

        self.assertIsInstance(e, Edge)
        self.assertEqual(e.from_, u)
        self.assertEqual(e.to, v)