コード例 #1
0
 def test_size(self):
     assert 0 == Graph().size()
     assert 1 == Graph([v, w], [vw, ]).size()
     print('hi')
     for n in range(8):
         print(n)
         g = Graph(make_vertices(n))
         g.add_all_edges()
         assert (n * (n - 1)) // 2 == g.size()
コード例 #2
0
def test_make_vertices():
    assert len(make_vertices(1)) == 1
    assert len(make_vertices(4)) == 4
    for v in make_vertices(2):
        assert isinstance(v, Vertex)
コード例 #3
0
 def test_order(self):
     assert 0 == Graph().order()
     assert 1 == Graph([v, ]).order()
     assert 4 == Graph([v, w, x, y]).order()
     g = Graph(make_vertices(10))
     assert 10 == g.order()