def test_merge_subset_new_recs_case(self): for i in range(0,10): if i < 3: # Assign the last signature to the first person. run_sql(self.query, (self.cluster + ".1", self.sigs[i][0], self.sigs[i][1], self.sigs[i][2])) elif i > 7: run_sql(self.query, (self.cluster + ".2", self.sigs[i][0], self.sigs[i][1], self.sigs[i][2])) # Two extra records one per author! last_bibref = get_last_bibref_value() last_recid = get_last_recid() sig = ["100", last_bibref +1, last_recid + 1] run_sql(self.query, (self.cluster + ".1", "100", last_bibref +1, last_recid + 1)) run_sql(self.query, (self.cluster + ".2", "100", last_bibref +2, last_recid + 2)) self.merge_func() first_author_sigs = self.sigs[0:5] recs_one = set([sig[2] for sig in first_author_sigs]) second_author_sigs = self.sigs[5:10] recs_two = set([sig[2] for sig in second_author_sigs]) self.assertMergeResults(recs_one, recs_two)
def setUp(self): ''' We create ten records for two authors of the same surname (cluster). Then we create an artificial result that may as well have been created by tortoise. ''' super(BibauthoridSymetricMergerTestCase, self).setUp() for i in range(0,10): last_bibref = get_last_bibref_value() last_recid = get_last_recid() sig = ["100", last_bibref +1, last_recid + 1] if i < 5: # The first 3 papers to the first author. add_signature(sig, self.first_author_name, self.author_id_one) else: # The other 7 to the second author. add_signature(sig, self.second_author_name, self.author_id_two) self.sigs.append(sig)
def setUp(self): super(BibauthoridAsymetricRejectMergerTestCase, self).setUp() for i in range(0,10): last_bibref = get_last_bibref_value() last_recid = get_last_recid() sig = ["100", last_bibref +1, last_recid + 1] if i == 0: add_signature(sig, self.second_author_name, self.author_id_two) add_signature(sig, self.first_author_name, self.author_id_one) run_sql("update aidPERSONIDPAPERS set flag=-2 where bibrec = %s and personid= %s", (sig[2], self.author_id_one)) elif i == 1: add_signature(sig, self.second_author_name, self.author_id_two) else: add_signature(sig, self.first_author_name, self.author_id_one) self.sigs.append(sig)
def setUp(self): super(BibauthoridBibrefMergerTestCase, self).setUp() last_bibref = get_last_bibref_value() last_recid = get_last_recid() # Record 1 rec_1 = last_recid + 1 sig = ["100", last_bibref + 1, rec_1] self.sigs.append(sig) add_signature(sig, self.first_author_name, self.author_id_one) sig = ["100", last_bibref + 2, rec_1] self.sigs.append(sig) add_signature(sig, self.first_author_name, self.author_id_one) sig = ["100", last_bibref + 3, rec_1] self.sigs.append(sig) rec_2 = rec_1 + 1 sig = ["100", last_bibref + 3, rec_2] self.sigs.append(sig) add_signature(sig, self.second_author_name, self.author_id_two)
def setUp(self): ''' We create ten records for two authors of the same surname (cluster). Then we create an artificial result that may as well have been created by tortoise. ''' super(BibauthoridSplitMergerTestCase, self).setUp() for i in range(0,10): last_bibref = get_last_bibref_value() last_recid = get_last_recid() sig = ["100", last_bibref +1, last_recid + 1] add_signature(sig, self.first_author_name, self.author_id_one) self.sigs.append(sig) for i in range(0,10): if i < 5: run_sql(self.query, (self.cluster + ".1", self.sigs[i][0], self.sigs[i][1], self.sigs[i][2])) else: run_sql(self.query, (self.cluster + ".2", self.sigs[i][0], self.sigs[i][1], self.sigs[i][2]))