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

Side by Side Diff: appengine/findit/crash/test/detect_regression_range_test.py

Issue 2414523002: [Findit] Reorganizing findit_for_*.py (Closed)
Patch Set: Finally fixed the mock tests! Created 4 years, 1 month 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
1 # Copyright 2016 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from testing_utils import testing 5 from testing_utils import testing
6 from crash.detect_regression_range import GetSpikes 6 from crash.detect_regression_range import GetSpikes
7 from crash.detect_regression_range import DetectRegressionRange 7 from crash.detect_regression_range import DetectRegressionRange
8 8
9 9
10 class DetectRegressionRangeTest(testing.AppengineTestCase): 10 class DetectRegressionRangeTest(testing.AppengineTestCase):
11 11
12 def _VerifyCasesForDetectRegressonRange(self, cases): 12 def _VerifyCasesForDetectRegressonRange(self, cases):
13 for case, expected_result in cases: 13 for case, expected_result in cases:
14 result = DetectRegressionRange(case) 14 result = DetectRegressionRange(case)
15 15 self.assertEqual(result, expected_result,
16 self.assertEqual(result, expected_result, 'Detected spikes of %s should ' 16 'Detected spikes of %s should be %s, instead of %s'
17 'be %s, instead of %s' % (repr(case), 17 % (repr(case), expected_result, result))
18 expected_result,
19 result))
20 18
21 19
22 # TODO(wrengr): make this test more comprehensive. 20 # TODO(wrengr): make this test more comprehensive.
23 def testGetSpikes(self): 21 def testGetSpikes(self):
24 get_value = lambda x: x[1] 22 get_value = lambda x: x[1]
25 e0 = ('1', 0.5) 23 e0 = ('1', 0.5)
26 e1 = ('1', 0) 24 e1 = ('1', 0)
27 e2 = ('2', 0.5) 25 e2 = ('2', 0.5)
28 self.assertEqual(GetSpikes([], get_value), 26 self.assertEqual(GetSpikes([], get_value),
29 []) 27 [])
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 ('4', '5')), 66 ('4', '5')),
69 ([{'chrome_version': '1', 'cpm': 0.06}, 67 ([{'chrome_version': '1', 'cpm': 0.06},
70 {'chrome_version': '2', 'cpm': 0.0003}, 68 {'chrome_version': '2', 'cpm': 0.0003},
71 {'chrome_version': '3', 'cpm': 0.0007}, 69 {'chrome_version': '3', 'cpm': 0.0007},
72 {'chrome_version': '4', 'cpm': 0.6}, 70 {'chrome_version': '4', 'cpm': 0.6},
73 {'chrome_version': '5', 'cpm': 0.002}], 71 {'chrome_version': '5', 'cpm': 0.002}],
74 ('3', '4'))] 72 ('3', '4'))]
75 73
76 self._VerifyCasesForDetectRegressonRange(cases) 74 self._VerifyCasesForDetectRegressonRange(cases)
77 75
OLDNEW
« no previous file with comments | « appengine/findit/crash/test/crash_test_suite.py ('k') | appengine/findit/crash/test/findit_for_chromecrash_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698