Beispiel #1
0
from expungeservice.util import DateWithFuture as date

from expungeservice.models.disposition import DispositionCreator
from expungeservice.models.expungement_result import EligibilityStatus
from expungeservice.models.charge_types.parking_ticket import ParkingTicket

from tests.factories.charge_factory import ChargeFactory
from tests.factories.case_factory import CaseSummaryFactory
from tests.models.test_charge import Dispositions


def test_parking_ticket_conviction():
    case = CaseSummaryFactory.create(
        type_status=["Municipal Parking", "Closed"])
    charge = ChargeFactory.create(
        case_number=case.case_number,
        name="Unknown",
        statute="109",
        level="Violation Unclassified",
        date=date(1901, 1, 1),
        disposition=Dispositions.CONVICTED,
        violation_type=case.violation_type,
    )

    assert isinstance(charge.charge_type, ParkingTicket)
    assert not charge.charge_type.blocks_other_charges
    assert charge.type_eligibility.status is EligibilityStatus.INELIGIBLE
    assert charge.type_eligibility.reason == "Ineligible under 137.225(7)(a)"


def test_parking_ticket_dismissal():
from expungeservice.models.charge_types.misdemeanor_class_bc import MisdemeanorClassBC
from expungeservice.models.charge_types.parking_ticket import ParkingTicket
from expungeservice.models.charge_types.person_felony import PersonFelonyClassB
from expungeservice.models.charge_types.sex_crimes import SexCrime
from expungeservice.models.charge_types.subsection_6 import Subsection6
from expungeservice.models.charge_types.traffic_offense import TrafficOffense
from expungeservice.models.charge_types.traffic_violation import TrafficViolation
from expungeservice.models.charge_types.unclassified_charge import UnclassifiedCharge

from tests.factories.charge_factory import ChargeFactory
from tests.factories.case_factory import CaseSummaryFactory
from tests.models.test_charge import Dispositions


def test_civil_offense_hidden_in_summary():
    case = CaseSummaryFactory.create(type_status=["Civil Offense", "Closed"])
    charge = ChargeFactory.create(
        case_number=case.case_number,
        name="Defamation",
        statute="99",
        level="N/A",
        disposition=Dispositions.CONVICTED,
        violation_type=case.violation_type,
    )

    assert isinstance(charge.charge_type, CivilOffense)
    assert charge.charge_type.hidden_in_record_summary(
        charge.disposition) == False


def test_duii_hidden_in_summary():