-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lesser Charge is identified by disposition string and has eligible/in…
…eligible options
- Loading branch information
Jordan Witte
authored and
Jordan Witte
committed
Feb 2, 2024
1 parent
be95a5d
commit d40ae3f
Showing
5 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/backend/expungeservice/models/charge_types/lesser_charge.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from dataclasses import dataclass | ||
|
||
from expungeservice.models.charge import ChargeType | ||
from expungeservice.models.expungement_result import TypeEligibility, EligibilityStatus | ||
|
||
|
||
@dataclass(frozen=True) | ||
class LesserChargeEligible(ChargeType): | ||
type_name: str = "Lesser Charge, Eligible" | ||
expungement_rules: str = """A conviction that has been dismissed due to a reduction to a lesser charge is eligible if and only if the new charge is eligible.""" | ||
blocks_other_charges: bool = False | ||
|
||
def type_eligibility(self, disposition): | ||
return TypeEligibility( | ||
EligibilityStatus.ELIGIBLE, | ||
reason="Reduced to another charge; eligible because the new charge is eligible.", | ||
) | ||
|
||
@dataclass(frozen=True) | ||
class LesserChargeIneligible(ChargeType): | ||
type_name: str = "Lesser Charge, Ineligible" | ||
expungement_rules: str = """A conviction that has been dismissed due to a reduction to a lesser charge is eligible if and only if the new charge is eligible.""" | ||
blocks_other_charges: bool = False | ||
|
||
def type_eligibility(self, disposition): | ||
return TypeEligibility( | ||
EligibilityStatus.INELIGIBLE, | ||
reason="Reduced to another charge; ineligible because the new charge is ineligible.", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/backend/tests/models/charge_types/test_lesser_charge.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from expungeservice.models.charge_types.felony_class_c import FelonyClassC | ||
from expungeservice.models.charge_types.sex_crimes import SexCrime | ||
from expungeservice.models.charge_types.traffic_offense import TrafficOffense | ||
from expungeservice.models.charge_types.misdemeanor_class_bc import MisdemeanorClassBC | ||
from expungeservice.models.charge_types.marijuana_eligible import MarijuanaEligible | ||
from expungeservice.models.charge_types.person_felony import PersonFelonyClassB | ||
from expungeservice.models.charge_types.felony_class_b import FelonyClassB | ||
from expungeservice.models.charge_types.lesser_charge import LesserChargeEligible, LesserChargeIneligible | ||
|
||
from tests.factories.charge_factory import ChargeFactory | ||
from tests.models.test_charge import Dispositions | ||
|
||
|
||
def test_lesser_charge(): | ||
charge = ChargeFactory.create_ambiguous_charge( | ||
name="Manufacture/Delivery", | ||
statute="4759922b", | ||
level="Felony Class A", | ||
disposition=Dispositions.LESSER_CHARGE, | ||
) | ||
assert isinstance(charge[0].charge_type, LesserChargeEligible) | ||
assert isinstance(charge[1].charge_type, LesserChargeIneligible) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters