def test_record_deduper_dup(self): record = factories.doctor_factory() diff_record = factories.doctor_factory() doctors = [models.Doctor(**diff_record)] record_deduper = deduper.RecordDeduper(record, doctors, deduper.DedupManager.DEFAULT_FIELD_WEIGHTINGS, deduper.DedupManager.DEFAULT_MATCH_THRESHOLD, deduper.DedupManager.DEFAULT_KILL_THRESHOLD, MetricsRegistry() ) new, doctor = record_deduper.run() self.assertFalse(new) self.assertEqual(type(doctor), models.Doctor) self.assertNotEqual(doctor, doctors[0])
def test_dedup_manager(self, MockRecordDeduper): dedupe_manager = deduper.DedupManager() record_deduper_instance = MockRecordDeduper.return_value record_deduper_instance.run.return_value = True, models.Doctor() record_deduper_instance.run.assert_called_once() record = factories.doctor_factory() dedupe_manager.dedup(record)
def test_dup_factory(self): original = factories.doctor_factory() dup = factories.dup_doctor_factory(original, {'source': 'new source'}) self.assertEqual(dup['source'], 'new source') self.assertTrue(dup['is_dup']) self.assertEqual(dup['last_name'], original['last_name'])