Esempio n. 1
0
def test_portgraph_add_vertex():
    pg = PortGraph()

    vid = pg.add_vertex()
    assert pg.nb_vertices() == 1
    assert_raises(InvalidVertex, lambda: pg.add_vertex(vid))

    assert len(tuple(pg.ports(vid))) == 0
    assert pg.actor(vid) is None
def test_portgraph_add_vertex():
    pg = PortGraph()

    vid = pg.add_vertex()
    assert pg.nb_vertices() == 1
    assert_raises(InvalidVertex, lambda: pg.add_vertex(vid))

    assert len(tuple(pg.ports(vid))) == 0
    assert pg.actor(vid) is None
Esempio n. 3
0
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_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
Esempio n. 5
0
def test_portgraph_init():
    pg = PortGraph()

    assert pg.nb_vertices() == 0
    assert pg.nb_edges() == 0
def test_portgraph_init():
    pg = PortGraph()

    assert pg.nb_vertices() == 0
    assert pg.nb_edges() == 0