def test_expunger_categorizes_charges(record_with_various_categories): acquittals, convictions = Expunger._categorize_charges( record_with_various_categories.charges) assert len(acquittals) == 5 assert len(convictions) == 4
case_number_with_comments = ( f"{case.summary.case_number} (in part - counts {in_part})" if ineligible_charges else case.summary.case_number) if eligible_charges: return FormFilling._build_pdf_for_eligible_case( case, eligible_charges, user_information, case_number_with_comments) @staticmethod def _build_pdf_for_eligible_case(case, eligible_charges, user_information, case_number_with_comments): charges = case.charges charge_names = [charge.name.title() for charge in charges] arrest_dates_all = list( set([charge.date.strftime("%b %-d, %Y") for charge in charges])) dismissals, convictions = Expunger._categorize_charges( eligible_charges) dismissed_names = [charge.name.title() for charge in dismissals] dismissed_arrest_dates = list( set([charge.date.strftime("%b %-d, %Y") for charge in dismissals])) dismissed_dates = list( set([ charge.disposition.date.strftime("%b %-d, %Y") for charge in dismissals ])) conviction_names = [charge.name.title() for charge in convictions] conviction_arrest_dates = list( set([charge.date.strftime("%b %-d, %Y") for charge in convictions])) conviction_dates = list( set([ charge.disposition.date.strftime("%b %-d, %Y")