Exemple #1
0
    def test_edge_count(self):
        g = Graph('sample_graph_1.txt')
        assert g.edge_count() == 4
        assert g.edge_count() != 0

        other_g = Graph('sample_graph_2.txt')
        assert other_g.edge_count() == 12
        assert other_g.edge_count() != 0

        another_g = Graph('sample_graph_3.txt')
        assert another_g.edge_count() == 27
        # make sure its not including empty parentheses or invalid data
        assert another_g.edge_count() != 29
        assert another_g.edge_count() != 31
        assert another_g.edge_count() != 0
Exemple #2
0
 def test_empty_graph(self):
     nothing = Graph('empty.txt')
     assert nothing.vertex_count() == 0
     assert nothing.edge_count() == 0
     assert nothing.edge_list() == []