コード例 #1
0
ファイル: graph_tests.py プロジェクト: pwoolcoc/Pylgrim
    def testVertexOutE(self):
        """
        Vertex().outE() should ret a list of the edges that go 'out' from it
        """
        u = Vertex()
        v = Vertex()

        e = u >> v

        self.assertEqual(u.outE(), {e})
コード例 #2
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'})
コード例 #3
0
ファイル: graph_tests.py プロジェクト: pwoolcoc/Pylgrim
    def testChainingSelectorsWithAttributeAccess(self):
        """
        Chain selectors together and request an attribute at the end of the chain
        """
        t = Vertex()
        u = Vertex()
        u.name = "I am U"

        e = t >> u

        should_be_i_am_u = t.outE().inV().name
        self.assertEqual(should_be_i_am_u, {"I am U"})
コード例 #4
0
ファイル: graph_tests.py プロジェクト: pwoolcoc/Pylgrim
    def testChainingSelectors(self):
        """Chain {in,out}{_,E,V} calls together"""
        t = Vertex()
        u = Vertex()
        e = t >> u

        # >>> t.outE()
        # {e}
        # >>> e.inV()
        # {u}
        should_be_u = t.outE().inV()

        self.assertEqual(should_be_u, {u})