def test_primary_key_uniquifier(self): keys = [('ffa68cde441dd0f919db8f33b381df5daf9ad409', '489483', '2015-06-03 10:48:41', 'https://codereview.chromium.org/1261433008', None, 'buildbucket-InvalidInputError-on-bad-parameters'), ('fcfc054b7fa5c4aafd55dca5ce12422e20833430', None, '2015-07-31 19:52:22', 'https://codereview.chromium.org/1060213002', None, 'monitoring-proxy-Fixed-HTTP-status-check'), ('fca719d9d9f9049b02af6296a406c4699dd1cf4b ', None, '2015-07-31 19:52:22', 'https://codereview.chromium.org/840743002', None, 'buildbucket-InvalidInputError-on-bad-parameters'), ('ffa68cde441dd0f919db8f33b381df5daf9ad409', '471408', '2015-07-31 19:52:22', 'https://codereview.chromium.org/1261433008', None, 'Buildbucket-ereporter2-recipients')] unique_keys = code_review_parse.primary_key_uniquifier(keys, lambda x: (x[0], x[3])) self.assertEqual(unique_keys, [('ffa68cde441dd0f919db8f33b381df5daf9ad409', '489483', '2015-06-03 10:48:41', 'https://codereview.chromium.org/1261433008', None, 'buildbucket-InvalidInputError-on-bad-parameters'), ('fcfc054b7fa5c4aafd55dca5ce12422e20833430', None, '2015-07-31 19:52:22', 'https://codereview.chromium.org/1060213002', None, 'monitoring-proxy-Fixed-HTTP-status-check'), ('fca719d9d9f9049b02af6296a406c4699dd1cf4b ', None, '2015-07-31 19:52:22', 'https://codereview.chromium.org/840743002', None, 'buildbucket-InvalidInputError-on-bad-parameters')]) no_effect = code_review_parse.primary_key_uniquifier(keys) self.assertEqual(no_effect, [('ffa68cde441dd0f919db8f33b381df5daf9ad409', '489483', '2015-06-03 10:48:41', 'https://codereview.chromium.org/1261433008', None, 'buildbucket-InvalidInputError-on-bad-parameters'), ('fcfc054b7fa5c4aafd55dca5ce12422e20833430', None, '2015-07-31 19:52:22', 'https://codereview.chromium.org/1060213002', None, 'monitoring-proxy-Fixed-HTTP-status-check'), ('fca719d9d9f9049b02af6296a406c4699dd1cf4b ', None, '2015-07-31 19:52:22', 'https://codereview.chromium.org/840743002', None, 'buildbucket-InvalidInputError-on-bad-parameters'), ('ffa68cde441dd0f919db8f33b381df5daf9ad409', '471408', '2015-07-31 19:52:22', 'https://codereview.chromium.org/1261433008', None,'Buildbucket-ereporter2-recipients')])
def parse_commit_people(git_log): """Extracts features associated with the people in a commit Arg: git_log(list): all commits in a git log parsed as dictionaries Return: commits(list): all commits represented by a tuple with the extracted features about each associated person """ commits = [] for commit in git_log: associated_people = get_features_for_commit_people(commit) uniq_primary_keys = crp.primary_key_uniquifier(associated_people, lambda x: (x[0].lower(), x[1], x[3])) for tup in uniq_primary_keys: commits.append(tup) return commits