def test_isMatch_defaultCompareNoExternalIds(self): charge = schema.StateCharge() charge_another = schema.StateCharge() self.assertTrue( _is_match(ingested_entity=charge, db_entity=charge_another)) charge.description = 'description' self.assertFalse( _is_match(ingested_entity=charge, db_entity=charge_another))
def test_isMatch_defaultCompareNoExternalIds(self): charge = StateCharge.new_with_defaults() charge_another = attr.evolve(charge) self.assertTrue( _is_match(ingested_entity=charge, db_entity=charge_another)) charge.description = 'description' self.assertFalse( _is_match(ingested_entity=charge, db_entity=charge_another))
def test_isMatch_defaultCompareExternalId(self): charge = StateCharge.new_with_defaults(external_id=_EXTERNAL_ID, description='description') charge_another = attr.evolve(charge, description='description_another') self.assertTrue( _is_match(ingested_entity=charge, db_entity=charge_another)) charge.external_id = _EXTERNAL_ID_2 self.assertFalse( _is_match(ingested_entity=charge, db_entity=charge_another))
def test_isMatch_statePersonAlias(self): alias = StatePersonAlias.new_with_defaults(state_code=_STATE_CODE, full_name='full_name') alias_another = attr.evolve(alias) self.assertTrue( _is_match(ingested_entity=alias, db_entity=alias_another)) alias_another.state_code = _STATE_CODE_ANOTHER self.assertFalse( _is_match(ingested_entity=alias, db_entity=alias_another))
def test_isMatch_statePersonAlias(self): alias = schema.StatePersonAlias(state_code=_STATE_CODE, full_name='full_name') alias_another = schema.StatePersonAlias(state_code=_STATE_CODE, full_name='full_name') self.assertTrue( _is_match(ingested_entity=alias, db_entity=alias_another)) alias_another.state_code = _STATE_CODE_ANOTHER self.assertFalse( _is_match(ingested_entity=alias, db_entity=alias_another))
def test_isMatch_defaultCompareExternalId(self) -> None: charge = schema.StateCharge(external_id=_EXTERNAL_ID, description="description") charge_another = schema.StateCharge(external_id=_EXTERNAL_ID, description="description_another") self.assertTrue( _is_match(ingested_entity=charge, db_entity=charge_another)) charge.external_id = _EXTERNAL_ID_2 self.assertFalse( _is_match(ingested_entity=charge, db_entity=charge_another))
def test_isMatch_statePerson(self): external_id = StatePersonExternalId.new_with_defaults( state_code=_STATE_CODE, external_id=_EXTERNAL_ID) external_id_different = attr.evolve(external_id, external_id=_EXTERNAL_ID_2) person = StatePerson.new_with_defaults(full_name='name', external_ids=[external_id]) person_another = StatePerson.new_with_defaults( full_name='name_2', external_ids=[external_id]) self.assertTrue( _is_match(ingested_entity=person, db_entity=person_another)) person_another.external_ids = [external_id_different] self.assertFalse( _is_match(ingested_entity=person, db_entity=person_another))
def test_isMatch_statePersonExternalId_stateCode(self): external_id = StatePersonExternalId.new_with_defaults( person_external_id_id=_ID, state_code=_STATE_CODE, id_type=_ID_TYPE, external_id=_EXTERNAL_ID) external_id_different = attr.evolve(external_id, person_external_id_id=None) self.assertTrue( _is_match(ingested_entity=external_id, db_entity=external_id_different)) external_id.state_code = _STATE_CODE_ANOTHER self.assertFalse( _is_match(ingested_entity=external_id, db_entity=external_id_different))
def test_isMatch_statePersonExternalId_type(self): external_id = schema.StatePersonExternalId(person_external_id_id=_ID, state_code=_STATE_CODE, id_type=_ID_TYPE, external_id=_EXTERNAL_ID) external_id_different = schema.StatePersonExternalId( person_external_id_id=None, state_code=_STATE_CODE, id_type=_ID_TYPE, external_id=_EXTERNAL_ID) self.assertTrue( _is_match(ingested_entity=external_id, db_entity=external_id_different)) external_id.id_type = _ID_TYPE_ANOTHER self.assertFalse( _is_match(ingested_entity=external_id, db_entity=external_id_different))
def test_isMatch_statePerson(self): external_id = schema.StatePersonExternalId(state_code=_STATE_CODE, external_id=_EXTERNAL_ID) external_id_same = schema.StatePersonExternalId( state_code=_STATE_CODE, external_id=_EXTERNAL_ID) external_id_different = schema.StatePersonExternalId( state_code=_STATE_CODE, external_id=_EXTERNAL_ID_2) person = schema.StatePerson(full_name='name', external_ids=[external_id]) person_another = schema.StatePerson(full_name='name_2', external_ids=[external_id_same]) self.assertTrue( _is_match(ingested_entity=person, db_entity=person_another)) person_another.external_ids = [external_id_different] self.assertFalse( _is_match(ingested_entity=person, db_entity=person_another))