def test_signed_partisan_scores_are_positive_if_first_party_has_advantage( mock_election): eg = efficiency_gap(mock_election) mm = mean_median(mock_election) pb = partisan_bias(mock_election) assert (eg > 0 and mm > 0 and pb > 0)
def test_signed_partisan_scores_point_the_same_way(mock_election): eg = efficiency_gap(mock_election) mm = mean_median(mock_election) pb = partisan_bias(mock_election) assert (eg > 0 and mm > 0 and pb > 0) or (eg < 0 and mm < 0 and pb < 0)
def test_efficiency_gap(mock_election): result = efficiency_gap(mock_election) assert result == 0.3