def checkEdges(self): conf = Configuration.load(self.codeface_conf, self.project_conf) dbm = DBManager(conf) project_id = dbm.getProjectID(conf["project"], self.tagging) persons = dbm.get_project_persons(project_id) # Create map from id to name person_map = {person[0]: person[1] for person in persons} given_correct_edges = self.correct_edges if given_correct_edges[0][0] is str: # simply check the first range given_correct_edges = [self.correct_edges] release_ranges = dbm.get_release_ranges(project_id) i = -1 for correct_edges in given_correct_edges: i += 1 release_range = release_ranges[i] cluster_id = dbm.get_cluster_id(project_id, release_range) edgelist = dbm.get_edgelist(cluster_id) # Create edge list with developer names test_edges = [[person_map[edge[0]], person_map[edge[1]], edge[2]] for edge in edgelist] ## Check number of matches with known correct edges match_count = 0 for test_edge in test_edges: if test_edge in correct_edges: match_count += 1 res = (match_count == len(correct_edges)) self.assertTrue( res, msg="Project edgelist is incorrect for the v{}_release " "to v{}_release analysis!".format(i, i + 1))
def checkEdges(self): conf = Configuration.load(self.codeface_conf, self.project_conf) dbm = DBManager(conf) project_id = dbm.getProjectID(conf["project"], self.tagging) persons = dbm.get_project_persons(project_id) # Create map from id to name person_map = {person[0] : person[1] for person in persons} given_correct_edges = self.correct_edges if given_correct_edges[0][0] is str: # simply check the first range given_correct_edges = [self.correct_edges] release_ranges = dbm.get_release_ranges(project_id) i = -1 for correct_edges in given_correct_edges: i += 1 release_range = release_ranges[i] cluster_id = dbm.get_cluster_id(project_id, release_range) edgelist = dbm.get_edgelist(cluster_id) # Create edge list with developer names test_edges = [[person_map[edge[0]], person_map[edge[1]], edge[2]] for edge in edgelist] ## Check number of matches with known correct edges match_count = 0 for test_edge in test_edges: if test_edge in correct_edges: match_count += 1 res = (match_count == len(correct_edges)) self.assertTrue( res, msg="Project edgelist is incorrect for the v{}_release " "to v{}_release analysis!" .format(i, i+1))
def checkEdges(self): conf = Configuration.load(self.codeface_conf, self.project_conf) dbm = DBManager(conf) project_id = dbm.getProjectID(conf["project"], self.tagging) cluster_id = dbm.get_cluster_id(project_id) edgelist = dbm.get_edgelist(cluster_id) persons = dbm.get_project_persons(project_id) # Create map from id to name person_map = {person[0] : person[1] for person in persons} # Create edge list with developer names test_edges = [[person_map[edge[0]], person_map[edge[1]], edge[2]] for edge in edgelist] ## Check number of matches with known correct edges match_count = 0 for test_edge in test_edges: if test_edge in self.correct_edges: match_count += 1 res = (match_count == len(self.correct_edges)) self.assertTrue(res, msg="Project edgelist is incorrect!")