Ejemplo n.º 1
0
def test_expected_districts_vacancies():
    expected = get_expected_districts({
        "upper_seats":
        3,
        "lower_seats": {
            "At-Large": 3
        },
        "vacancies": [
            {
                "chamber": "upper",
                "district": "2",
                "vacant_until": datetime.date(2100, 1, 1)
            },
            {
                "chamber": "lower",
                "district": "At-Large",
                "vacant_until": datetime.date(2100, 1, 1)
            },
        ]
    })
    assert expected['upper'] == {"1": 1, "2": 0, "3": 1}
    assert expected['lower'] == {"At-Large": 2}

    with pytest.raises(BadVacancy):
        get_expected_districts({
            "upper_seats":
            3,
            "vacancies": [
                {
                    "chamber": "upper",
                    "district": "2",
                    "vacant_until": datetime.date(2000, 1, 1)
                },
            ]
        })
Ejemplo n.º 2
0
def test_expected_districts_vacancies():
    vacancies = {
        "ne": {
            "vacancies": [{
                "chamber": "legislature",
                "district": "1",
                "vacant_until": datetime.date(2100, 1, 1),
            }]
        }
    }
    expected = get_expected_districts(vacancies, "ne")
    assert expected["legislature"]["1"] == 0

    with pytest.raises(BadVacancy):
        get_expected_districts(
            {
                "ne": {
                    "vacancies": [{
                        "chamber": "upper",
                        "district": "2",
                        "vacant_until": datetime.date(2000, 1, 1),
                    }]
                }
            },
            "ne",
        )
Ejemplo n.º 3
0
def test_get_expected_districts():
    expected = get_expected_districts({}, "ne")
    assert len(expected["legislature"]) == 49
    assert expected["legislature"]["1"] == 1

    expected = get_expected_districts({}, "md")
    print(expected)
    assert expected["lower"]["3A"] == 2
    assert expected["lower"]["3B"] == 1
Ejemplo n.º 4
0
def test_get_expected_districts():
    expected = get_expected_districts({"upper_seats": 3,
                                       "lower_seats": ["A", "B", "C"],
                                       "legislature_seats": {"At-Large": 3}})
    assert expected['upper'] == {"1": 1, "2": 1, "3": 1}
    assert expected['lower'] == {"A": 1, "B": 1, "C": 1}
    assert expected['legislature'] == {"At-Large": 3}