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]))
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]) )
def setUp(self): id_generator = IDGenerator() self.marko = Vertex( "Father", name="Marko", surname="Jones", age=30, ) self.john = Vertex( "Brother", name="John", surname="Jones", age=30 ) self.peter = Vertex( "Uncle", name="Peter", surname="Doe", age=20 ) # add id's to the unbound vertices self.marko.ident = id_generator.get_vertex_id() self.john.ident = id_generator.get_vertex_id() self.peter.ident = id_generator.get_vertex_id() self.container = EntitySet([self.marko, self.john, self.peter])