Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: appengine/findit/crash/scorers/test/aggregators_test.py

Issue 2707603002: [Predator] Generate all changelogs in regression ranges instead of only matched changelogs (Closed)
Patch Set: . Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from crash.stacktrace import StackFrame
6 from crash.suspect import Suspect
7 from crash.scorers import aggregators
8 from crash.scorers.min_distance import MinDistance
9 from crash.scorers.test.scorer_test_suite import ScorerTestSuite
10 from crash.scorers.top_frame_index import TopFrameIndex
11
12
13 class AggregatorsTest(ScorerTestSuite):
14
15 def testMultiplier(self):
16 aggregator = aggregators.Multiplier()
17 self.assertEqual(aggregator.Aggregate([1, 0.5, 0.2]), 0.1)
18 self.assertEqual(aggregator([None, None]), None)
19 self.assertEqual(aggregator([1, 0.5, 0.2]), 0.1)
20
21 def testIdentityAggregator(self):
22 aggregator = aggregators.IdentityAggregator()
23 self.assertEqual(aggregator.Aggregate([1, 0.5, 0.2]), [1, 0.5, 0.2])
24 self.assertEqual(aggregator([1, 0.5, 0.2]), [1, 0.5, 0.2])
25
26 def testChangedFilesAggregator(self):
27 aggregator = aggregators.ChangedFilesAggregator()
28 file_info_list = [
29 [
30 {'file': 'f1.cc', 'blame_url': 'https://repo_url',
31 'info': 'scorer 1'},
32 {'file': 'f2.cc', 'blame_url': 'https://repo_url',
33 'info': 'scorer 1'},
34 ],
35 [
36 {'file': 'f1.cc', 'blame_url': 'https://repo_url',
37 'info': None},
38 {'file': 'f2.cc', 'blame_url': 'https://repo_url',
39 'info': 'scorer 2'},
40 ],
41 ]
42 self.assertEqual(aggregator(file_info_list),
43 [{'file': 'f1.cc', 'blame_url': 'https://repo_url',
44 'info': 'scorer 1'},
45 {'file': 'f2.cc', 'blame_url': 'https://repo_url',
46 'info': 'scorer 1\nscorer 2'}])
47
48
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698