test_mop.test_person_MoP()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 38
Code Lines 30

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 30
dl 0
loc 38
rs 9.16
c 0
b 0
f 0
cc 1
nop 1
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
# test_person.py
4
"""Tests for `person` package."""
5
import pytest
6
from context import helpers  # noqa
7
from context import mop_role
8
9
# pylint: disable=redefined-outer-name
10
11
12
def test_person_MoP(mop_fixture):
13
    # pylint: disable=W0612, W0613
14
15
    mop = mop_role.MoP(
16
        "14",
17
        "NRW",
18
        "Grüne",
19
        "Alfons-Reimund",
20
        "Hubbeldubbel",
21
        peer_title="auf der",
22
        electoral_ward="Ennepe-Ruhr-Kreis I",
23
        minister="JM",
24
    )
25
26
    assert mop.legislature == "14"  # nosec
27
    assert mop.first_name == "Alfons-Reimund"  # nosec
28
    assert mop.last_name == "Hubbeldubbel"  # nosec
29
    assert mop.gender == "male"  # nosec
30
    assert mop.peer_preposition == "auf der"  # nosec
31
    assert mop.party_name == "Grüne"  # nosec
32
    assert mop.parties == [  # nosec
33
        helpers.Party(
34
            party_name="Grüne", party_entry="unknown", party_exit="unknown"
35
        )  # noqa  # nosec
36
    ]  # noqa  # nosec
37
    assert mop.ward_no == 105  # nosec
38
    assert mop.minister == "JM"  # nosec
39
40
    mop.add_Party("fraktionslos")
41
    assert mop.party_name == "fraktionslos"  # nosec
42
    assert mop.parties == [  # nosec
43
        helpers.Party(
44
            party_name="Grüne", party_entry="unknown", party_exit="unknown"
45
        ),  # noqa  # nosec
46
        helpers.Party(
47
            party_name="fraktionslos",
48
            party_entry="unknown",
49
            party_exit="unknown",  # noqa  # nosec
50
        ),
51
    ]
52
53
54
def test_person_NotInRangeError(notinrange_fixture):
55
    # pylint: disable=W0612, W0613
56
    mop = mop_role.MoP
57
58
    with pytest.raises(helpers.NotInRange):
59
        mop("100", "NRW", "SPD", "Alfons-Reimund", "Hubbeldubbel")
60