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

Unified Diff: appengine/findit/crash/scorers/test/aggregators_test.py

Issue 2157433002: [Findit] Pass changed files info to Fracas, 2 face design. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix nits. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: appengine/findit/crash/scorers/test/aggregators_test.py
diff --git a/appengine/findit/crash/scorers/test/aggregators_test.py b/appengine/findit/crash/scorers/test/aggregators_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..25e063789642ac08672c4e0d3869dab5035042f2
--- /dev/null
+++ b/appengine/findit/crash/scorers/test/aggregators_test.py
@@ -0,0 +1,48 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from crash.callstack import StackFrame
+from crash.results import MatchResult
+from crash.scorers import aggregators
+from crash.scorers.min_distance import MinDistance
+from crash.scorers.test.scorer_test_suite import ScorerTestSuite
+from crash.scorers.top_frame_index import TopFrameIndex
+
+
+class AggregatorsTest(ScorerTestSuite):
+
+ def testMultiplier(self):
+ aggregator = aggregators.Multiplier()
+ self.assertEqual(aggregator.Aggregate([1, 0.5, 0.2]), 0.1)
+ self.assertEqual(aggregator([None, None]), None)
+ self.assertEqual(aggregator([1, 0.5, 0.2]), 0.1)
+
+ def testIdentityAggregator(self):
+ aggregator = aggregators.IdentityAggregator()
+ self.assertEqual(aggregator.Aggregate([1, 0.5, 0.2]), [1, 0.5, 0.2])
+ self.assertEqual(aggregator([1, 0.5, 0.2]), [1, 0.5, 0.2])
+
+ def testChangedFilesAggregator(self):
+ aggregator = aggregators.ChangedFilesAggregator()
+ file_info_list = [
+ [
+ {'file': 'f1.cc', 'blame_url': 'https://repo_url',
+ 'info': 'scorer 1'},
+ {'file': 'f2.cc', 'blame_url': 'https://repo_url',
+ 'info': 'scorer 1'},
+ ],
+ [
+ {'file': 'f1.cc', 'blame_url': 'https://repo_url',
+ 'info': None},
+ {'file': 'f2.cc', 'blame_url': 'https://repo_url',
+ 'info': 'scorer 2'},
+ ],
+ ]
+ self.assertEqual(aggregator(file_info_list),
+ [{'file': 'f1.cc', 'blame_url': 'https://repo_url',
+ 'info': 'scorer 1'},
+ {'file': 'f2.cc', 'blame_url': 'https://repo_url',
+ 'info': 'scorer 1\nscorer 2'}])
+
+
« no previous file with comments | « appengine/findit/crash/scorers/test/aggregator_test.py ('k') | appengine/findit/crash/scorers/test/min_distance_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698