def test_full_cases_for_revoked_probation(self): assert FuzzySearch.search(CaseDetails.CASE_WITH_REVOKED_PROBATION, PROBATION_REVOKED_SEARCH_TERMS) assert not FuzzySearch.search(CaseDetails.CASE_PARKING_VIOLATION, PROBATION_REVOKED_SEARCH_TERMS) assert not FuzzySearch.search( CaseDetails.CASE_WITHOUT_FINANCIAL_SECTION, PROBATION_REVOKED_SEARCH_TERMS)
def __parse_probation_revoked(event): event_parts = event.contents assert len(event_parts) == 4 date, empty_one, empty_two, event_table_wrapper = event_parts if FuzzySearch.search(event_table_wrapper.text, PROBATION_REVOKED_SEARCH_TERMS): return date.text
def feed(data) -> CaseParserData: soup = BeautifulSoup(data, "html.parser") hashed_charge_data = CaseParser.__build_charge_table_data(soup) hashed_dispo_data = CaseParser.__build_hashed_dispo_data(soup) balance_due = CaseParser.__build_balance_due(soup) probation_revoked = FuzzySearch.search(data, PROBATION_REVOKED_SEARCH_TERMS) return CaseParserData(hashed_charge_data, hashed_dispo_data, balance_due, probation_revoked)
def test_simple_probation_revoked_search(self): text = """ Comment: PROB REVOKED; Court Action: Signed; Court Action Date: 11/08/2010; Judge: Judge; """ assert FuzzySearch.search(text, PROBATION_REVOKED_SEARCH_TERMS)
def test_negative_probation_revoked_search(self): text = """ Status: Superseded on: Apr 6 2010 12:00AM Probation Cond..... All General Conditions Apply Sentence Status:Superseded Sentence Date:04/06/2010 Guidelines: Severity 1 History E """ assert not FuzzySearch.search(text, PROBATION_REVOKED_SEARCH_TERMS)
def test_simple_probation_revoked_search_with_html_tags(self): text = """ ... <td class="ssMenuText ssSmallText"> <div class="ssPreFormatted ssMenuText ssSmallText" style="display:list-item;"> ... Special Factor: 137.010 Presumptive Sntc PV Jail w/Credit Time Srv 60 Day(s) PV Post Prison Spvsn 1 Year(s) PV Probation Revked </div> </td> </tr> </table> </nobr> """ assert FuzzySearch.search(text, PROBATION_REVOKED_SEARCH_TERMS)
def feed(self, data): super().feed(data) self.probation_revoked = FuzzySearch.search( data, PROBATION_REVOKED_SEARCH_TERMS)
def test_simple_searches(self): text = "The quick brown fox jumps over the lazy dog." assert FuzzySearch.search(text, ["fox"]) assert FuzzySearch.search(text, ["ffox"]) assert FuzzySearch.search(text, ["FFOX"]) assert not FuzzySearch.search(text, ["panda"])