コード例 #1
0
    def test_union_filter_for_labels_with_no_props(self):
        id_generator = IDGenerator()
        marko = Vertex(
            "person",
            name="Marko",
        )
        josh = Vertex(
            "person",
            name="Marko",
        )
        edge = Edge(marko, "father", josh)
        edge2 = Edge(josh, "son", marko)

        # attach ID's to the vertices and edges.
        marko.ident = id_generator.get_vertex_id()
        josh.ident = id_generator.get_vertex_id()
        edge.ident = id_generator.get_edge_id()
        edge2.ident = id_generator.get_edge_id()

        container1 = EntitySet()
        container2 = EntitySet()

        container1.add(edge)
        container2.add(edge2)
        container3 = container1 | container2

        self.assertEqual(container3.filter("father").sorted(), sorted([edge]))
        self.assertEqual(container3.filter("son").sorted(), sorted([edge2]))
コード例 #2
0
ファイル: test_entities_sets.py プロジェクト: afmacedo/ruruki
    def test_union_filter_for_labels_with_no_props(self):
        id_generator = IDGenerator()
        marko = Vertex(
            "person",
            name="Marko",
        )
        josh = Vertex(
            "person",
            name="Marko",
        )
        edge = Edge(marko, "father", josh)
        edge2 = Edge(josh, "son", marko)

        # attach ID's to the vertices and edges.
        marko.ident = id_generator.get_vertex_id()
        josh.ident = id_generator.get_vertex_id()
        edge.ident = id_generator.get_edge_id()
        edge2.ident = id_generator.get_edge_id()

        container1 = EntitySet()
        container2 = EntitySet()

        container1.add(edge)
        container2.add(edge2)
        container3 = container1 | container2

        self.assertEqual(
            container3.filter("father").sorted(),
            sorted([edge])
        )
        self.assertEqual(
            container3.filter("son").sorted(),
            sorted([edge2])
        )
コード例 #3
0
 def test_append_vertex_with_ident_set(self):
     node = Vertex(label="NODE")
     node.ident = 0
     self.assertRaises(
         interfaces.EntityIDError,
         self.graph.append_vertex,
         node
     )
コード例 #4
0
 def test_add_dup_id(self):
     sue = Vertex("person", name="dup_vertex_id")
     sue.ident = 0
     self.assertRaises(
         KeyError,
         self.container.add,
         sue
     )
コード例 #5
0
ファイル: test_entities_sets.py プロジェクト: afmacedo/ruruki
 def test_add_dup_id(self):
     sue = Vertex("person", name="dup_vertex_id")
     sue.ident = 0
     self.assertRaises(
         KeyError,
         self.container.add,
         sue
     )