def test_good_partition(self): """Tests that a good partition has a high coverage measure.""" G = barbell_graph(3, 0) partition = [{0, 1, 2}, {3, 4, 5}] assert 6 / 7 == pytest.approx(coverage(G, partition), abs=1e-7) assert 6 / 7 == pytest.approx(partition_quality(G, partition)[0], abs=1e-7)
def test_bad_partition(self): """Tests that a poor partition has a low coverage measure.""" G = barbell_graph(3, 0) partition = [{0, 1, 4}, {2, 3, 5}] assert 3 / 7 == pytest.approx(coverage(G, partition), abs=1e-7) assert 3 / 7 == pytest.approx(partition_quality(G, partition)[0], abs=1e-7)
def test_good_partition(self): """Tests that a good partition has a high performance measure.""" G = barbell_graph(3, 0) partition = [{0, 1, 2}, {3, 4, 5}] assert 14 / 15 == pytest.approx(performance(G, partition), abs=1e-7) assert 14 / 15 == pytest.approx(partition_quality(G, partition)[1], abs=1e-7)
def test_bad_partition(self): """Tests that a poor partition has a low performance measure.""" G = barbell_graph(3, 0) partition = [{0, 1, 4}, {2, 3, 5}] assert 8 / 15 == pytest.approx(performance(G, partition), abs=1e-7) assert 8 / 15 == pytest.approx(partition_quality(G, partition)[1], abs=1e-7)
def test_good_partition(self): """Tests that a good partition has a high coverage measure.""" G = barbell_graph(3, 0) partition = [{0, 1, 2}, {3, 4, 5}] assert almost_equal(6 / 7, coverage(G, partition)) assert almost_equal(6 / 7, partition_quality(G, partition)[0])
def test_bad_partition(self): """Tests that a poor partition has a low coverage measure.""" G = barbell_graph(3, 0) partition = [{0, 1, 4}, {2, 3, 5}] assert almost_equal(3 / 7, coverage(G, partition)) assert almost_equal(3 / 7, partition_quality(G, partition)[0])
def test_good_partition(self): """Tests that a good partition has a high performance measure.""" G = barbell_graph(3, 0) partition = [{0, 1, 2}, {3, 4, 5}] assert almost_equal(14 / 15, performance(G, partition)) assert almost_equal(14 / 15, partition_quality(G, partition)[1])
def test_bad_partition(self): """Tests that a poor partition has a low performance measure.""" G = barbell_graph(3, 0) partition = [{0, 1, 4}, {2, 3, 5}] assert almost_equal(8 / 15, performance(G, partition)) assert almost_equal(8 / 15, partition_quality(G, partition)[1])