-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1721 from wittejm/lesser-charge
Lesser Charge
- Loading branch information
Showing
5 changed files
with
55 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
27 changes: 27 additions & 0 deletions
27
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,27 @@ | ||
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.""" | ||
|
||
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.""" | ||
|
||
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
15 changes: 15 additions & 0 deletions
15
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,15 @@ | ||
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