def test_charge_match_external_ids(self): db_charge = entities.Charge.new_with_defaults(external_id=_EXTERNAL_ID) ingested_charge = entities.Charge.new_with_defaults( external_id=_EXTERNAL_ID) self.assertTrue(county_matching_utils.is_charge_match( db_entity=db_charge, ingested_entity=ingested_charge)) ingested_charge.external_id = _EXTERNAL_ID_OTHER self.assertFalse(county_matching_utils.is_charge_match( db_entity=db_charge, ingested_entity=ingested_charge))
def test_charge_match_without_children(self): db_charge = entities.Charge.new_with_defaults( charge_id=_CHARGE_ID, name=_CHARGE_NAME, judge_name=_JUDGE_NAME, bond=entities.Bond.new_with_defaults( bond_type=BondType.NOT_REQUIRED)) ingested_charge = entities.Charge.new_with_defaults( charge_id=_CHARGE_ID_OTHER, name=_CHARGE_NAME, judge_name=_JUDGE_NAME_OTHER, bond=entities.Bond.new_with_defaults(bond_type=BondType.CASH)) self.assertTrue(county_matching_utils.is_charge_match( db_entity=db_charge, ingested_entity=ingested_charge)) ingested_charge.name = _CHARGE_NAME_2 self.assertFalse(county_matching_utils.is_charge_match( db_entity=db_charge, ingested_entity=ingested_charge))