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

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

Issue 2590313002: Added Blame.AddReagions(iterable) method (Closed)
Patch Set: changing Blame.AddRegions to use list.extend Created 4 years 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 crash.stacktrace import StackFrame 5 from crash.stacktrace import StackFrame
6 from crash.suspect import AnalysisInfo 6 from crash.suspect import AnalysisInfo
7 from crash.suspect import StackInfo 7 from crash.suspect import StackInfo
8 from crash.suspect import Suspect 8 from crash.suspect import Suspect
9 from crash.suspect import SuspectMap 9 from crash.suspect import SuspectMap
10 from crash.suspect import _UpdateSuspect 10 from crash.suspect import _UpdateSuspect
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 'committer_time': 'Thu Mar 31 21:28:39 2016', 58 'committer_time': 'Thu Mar 31 21:28:39 2016',
59 'commit_url': 59 'commit_url':
60 'https://repo.test/+/2', 60 'https://repo.test/+/2',
61 'code_review_url': 'https://codereview.chromium.org/3290', 61 'code_review_url': 'https://codereview.chromium.org/3290',
62 'committer_name': 'e', 62 'committer_name': 'e',
63 'revision': '2', 63 'revision': '2',
64 'reverted_revision': None 64 'reverted_revision': None
65 }) 65 })
66 66
67 DUMMY_BLAME = Blame('4', 'a.cc') 67 DUMMY_BLAME = Blame('4', 'a.cc')
68 DUMMY_BLAME.AddRegion( 68 DUMMY_BLAME.AddRegions([
69 Region(1, 5, '2', 'r', 'r@chromium.org', 'Thu Mar 25 21:24:43 2016')) 69 Region(1, 5, '2', 'r', 'r@chromium.org', 'Thu Mar 25 21:24:43 2016'),
70 DUMMY_BLAME.AddRegion( 70 Region(6, 3, '1', 'e', 'e@chromium.org', 'Thu Mar 31 21:24:43 2016'),
71 Region(6, 3, '1', 'e', 'e@chromium.org', 'Thu Mar 31 21:24:43 2016')) 71 Region(9, 2, '3', 'k', 'k@chromium.org', 'Thu Apr 1 21:24:43 2016')])
72 DUMMY_BLAME.AddRegion(
73 Region(9, 2, '3', 'k', 'k@chromium.org', 'Thu Apr 1 21:24:43 2016'))
74 72
75 DUMMY_BLAME2 = Blame('4', 'b.cc') 73 DUMMY_BLAME2 = Blame('4', 'b.cc')
76 DUMMY_BLAME2.AddRegion( 74 DUMMY_BLAME2.AddRegions([
77 Region(1, 5, '2', 'r', 'r@chromium.org', 'Thu Mar 25 21:24:43 2016')) 75 Region(1, 5, '2', 'r', 'r@chromium.org', 'Thu Mar 25 21:24:43 2016'),
78 DUMMY_BLAME2.AddRegion( 76 Region(6, 3, '1', 'e', 'e@chromium.org', 'Thu Mar 31 21:24:43 2016')])
79 Region(6, 3, '1', 'e', 'e@chromium.org', 'Thu Mar 31 21:24:43 2016'))
80 77
81 78
82 class SuspectTest(CrashTestSuite): 79 class SuspectTest(CrashTestSuite):
83 80
84 def testSuspectToDict(self): 81 def testSuspectToDict(self):
85 82
86 suspect = Suspect(DUMMY_CHANGELOG1, 'src/', 83 suspect = Suspect(DUMMY_CHANGELOG1, 'src/',
87 confidence=1, reasons=['MinDistance', 0.5, 'some reason'], 84 confidence=1, reasons=['MinDistance', 0.5, 'some reason'],
88 changed_files={'file': 'f', 'blame_url': 'http://b', 85 changed_files={'file': 'f', 'blame_url': 'http://b',
89 'info': 'min distance (LOC) 5'}) 86 'info': 'min distance (LOC) 5'})
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 188 }
192 expected_suspect.file_to_analysis_info = { 189 expected_suspect.file_to_analysis_info = {
193 'a.cc': AnalysisInfo(min_distance = 0, min_distance_frame = frame1), 190 'a.cc': AnalysisInfo(min_distance = 0, min_distance_frame = frame1),
194 'b.cc': AnalysisInfo(min_distance = 3, min_distance_frame = frame2), 191 'b.cc': AnalysisInfo(min_distance = 3, min_distance_frame = frame2),
195 } 192 }
196 193
197 expected_suspects = SuspectMap(ignore_cls=set(['2'])) 194 expected_suspects = SuspectMap(ignore_cls=set(['2']))
198 expected_suspects['1'] = expected_suspect 195 expected_suspects['1'] = expected_suspect
199 196
200 self._VerifyTwoSuspectMapEqual(suspects, expected_suspects) 197 self._VerifyTwoSuspectMapEqual(suspects, expected_suspects)
OLDNEW
« no previous file with comments | « appengine/findit/crash/test/changelist_classifier_test.py ('k') | appengine/findit/libs/gitiles/blame.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698