def test_portgraph_clear(): pg = PortGraph() vid1 = pg.add_vertex() vid2 = pg.add_vertex() pid1 = pg.add_in_port(vid1, "in") pid2 = pg.add_out_port(vid2, "out") pg.connect(pid2, pid1) pg.clear() assert pg.nb_vertices() == 0 assert pg.nb_edges() == 0 assert len(tuple(pg.ports())) == 0
def test_portgraph_init(): pg = PortGraph() assert pg.nb_vertices() == 0 assert pg.nb_edges() == 0