diff --git a/tests/test_graph.py b/tests/test_graph.py index 9d01912..576c7a5 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -1,22 +1,26 @@ from graph import GraphState import tables as lc +import time + def demograph(): g = GraphState() - g.add_edge(0,1) - g.add_edge(1,2) - g.add_edge(2,0) - g.add_edge(0,3) - g.add_edge(100,200) + g.add_edge(0, 1) + g.add_edge(1, 2) + g.add_edge(2, 0) + g.add_edge(0, 3) + g.add_edge(100, 200) return g + def test_graph(): g = demograph() - assert g.ngbh[0]==set([1,2,3]) - g.del_edge(0,1) - assert g.ngbh[0]==set([2, 3]) - assert g.has_edge(1,2) - assert not g.has_edge(0,1) + assert g.ngbh[0] == set([1, 2, 3]) + g.del_edge(0, 1) + assert g.ngbh[0] == set([2, 3]) + assert g.has_edge(1, 2) + assert not g.has_edge(0, 1) + def test_local_complementation(): """ Test that local complementation works as expected """ @@ -30,6 +34,7 @@ def test_local_complementation(): # TODO: test VOP conditions + def test_remove_vop(): """ Test that removing VOPs really works """ g = demograph() @@ -42,12 +47,20 @@ def test_remove_vop(): g.remove_vop(0, 1) assert g.vops[0] == lc.by_name["identity"] + def test_edgelist(): """ Test making edgelists """ g = demograph() el = g.edgelist() - assert (0,3) in el - assert (0,2) in el - assert (100,200) in el + assert (0, 3) in el + assert (0, 2) in el + assert (100, 200) in el +def test_million_sites(): + """ Testing making really big graphs """ + g = GraphState() + t = time.clock() + for i in xrange(100000): + g.add_edge(i, i + 1) + print time.clock() - t diff --git a/tests/test_viz.py b/tests/test_viz.py index 5254f0d..05350ec 100644 --- a/tests/test_viz.py +++ b/tests/test_viz.py @@ -8,6 +8,5 @@ def test_viz(): g.add_edge(2,0) g.add_edge(0,3) g.add_edge(100,200) - print g.vops #g.remove_vop(0, 1) viz.draw(g)