def test_search_function(): record = CrawlerFactory.create( JohnDoe.RECORD, { "X0001": CaseDetails.CASE_X1, "X0002": CaseDetails.CASE_WITHOUT_FINANCIAL_SECTION, "X0003": CaseDetails.CASE_WITHOUT_DISPOS, }, ) # sorting by date results in the order X0003, X0002, X0001 assert record.__class__ == Record assert len(record.cases) == 3 assert len(record.cases[2].charges) == 3 assert len(record.cases[1].charges) == 1 assert len(record.cases[0].charges) == 3 assert record.cases[2].charges[0].disposition.ruling == "Convicted - Failure to Appear" assert record.cases[2].charges[0].disposition.date == date_class(2017, 6, 12) assert record.cases[2].charges[1].disposition.ruling == "Dismissed" assert record.cases[2].charges[1].disposition.date == date_class(2017, 6, 12) assert record.cases[2].charges[2].disposition.ruling == "Dismissed" assert record.cases[2].charges[2].disposition.date == date_class(2017, 6, 12) assert record.cases[1].charges[0].disposition.ruling == "Dismissed" assert record.cases[1].charges[0].disposition.date == date_class(1992, 4, 30) assert record.cases[0].charges[0].disposition.status == DispositionStatus.UNKNOWN assert record.cases[0].charges[0].disposition.status == DispositionStatus.UNKNOWN assert record.cases[0].charges[1].disposition.status == DispositionStatus.UNKNOWN assert record.cases[0].charges[1].disposition.status == DispositionStatus.UNKNOWN assert record.cases[0].charges[2].disposition.status == DispositionStatus.UNKNOWN assert record.cases[0].charges[2].disposition.status == DispositionStatus.UNKNOWN
def test_single_charge_conviction(): record = CrawlerFactory.create(JohnDoe.SINGLE_CASE_RECORD, {"CASEJD1": CaseDetails.CASEJD1}) assert len(record.cases) == 1 assert len(record.cases[0].charges) == 1 assert record.cases[0].charges[0].name == "Loading Zone" assert record.cases[0].charges[0].statute == "29" assert record.cases[0].charges[0].level == "Violation Unclassified" assert record.cases[0].charges[0].date == date_class(2008, 9, 4) assert record.cases[0].charges[0].disposition.ruling == "Convicted" assert record.cases[0].charges[0].disposition.date == date_class(2008, 11, 18)
def create_dismissed_charge( cls, case_number=1, name="Theft of services", statute="164.125", level="Misdemeanor Class A", date=date_class(1901, 1, 1), violation_type="Offense Misdemeanor", ) -> Charge: cls.charge_count += 1 disposition = DispositionCreator.create(date=date_class.today(), ruling="Dismissed") kwargs = { "case_number": case_number, "name": name, "statute": statute, "level": level, "date": date, "disposition": disposition, "violation_type": violation_type, "balance_due_in_cents": 0, "edit_status": EditStatus.UNCHANGED, } charges = ChargeCreator.create(str(cls.charge_count), **kwargs)[0] assert len(charges) == 1 return charges[0]
def is_qualifying_mj_conviction(self): # See https://www.oregonlaws.org/ors/475B.401 from expungeservice.models.charge_types.marijuana_eligible import MarijuanaViolation is_qualifying_type = "Poss LT 1 Oz Marijuana" in self.name or isinstance( self.charge_type, MarijuanaViolation) is_qualifying_date = self.date < date_class(2015, 7, 1) return is_qualifying_type and is_qualifying_date and self.convicted()
def _build_ambiguous_charge(cls, case_number, date, disposition, level, name, statute, violation_type): cls.charge_count += 1 if disposition.status != DispositionStatus.UNKNOWN and not date: updated_date = disposition.date elif date: updated_date = date else: updated_date = date_class(1901, 1, 1) kwargs = { "case_number": case_number, "name": name, "statute": statute, "level": level, "date": updated_date, "disposition": disposition, "violation_type": violation_type, "balance_due_in_cents": 0, } charges = ChargeCreator.create(str(cls.charge_count), **kwargs)[0] return charges
assert charges[0].charge_type.hidden_in_record_summary( charges[0].disposition) == False assert isinstance(charges[1].charge_type, DismissedCharge) assert charges[1].charge_type.hidden_in_record_summary( charges[1].disposition) == False def test_felony_class_a_hidden_in_summary(): case = CaseSummaryFactory.create( type_status=["Offense Felony Class A", "Closed"]) charge = ChargeFactory.create( case_number=case.case_number, name="Assault in the first degree", statute="163.185", level="Felony Class A", date=date_class(1901, 1, 1), disposition=Dispositions.CONVICTED, violation_type=case.violation_type, ) assert isinstance(charge.charge_type, FelonyClassA) assert charge.charge_type.hidden_in_record_summary( charge.disposition) == False def test_felony_class_b_hidden_in_summary(): case = CaseSummaryFactory.create( type_status=["Offense Felony Class B", "Closed"]) charge = ChargeFactory.create( case_number=case.case_number, name="Aggravated theft in the first degree",