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

Unified Diff: appengine/findit/crash/test/culprit_test.py

Issue 2449853012: [Predator] Fix bug in min_distance after refactor and add back skip added/deleted deps. (Closed)
Patch Set: Add culprit test. 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 side-by-side diff with in-line comments
Download patch
Index: appengine/findit/crash/test/culprit_test.py
diff --git a/appengine/findit/crash/test/culprit_test.py b/appengine/findit/crash/test/culprit_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..cd6b5e4f5aec7ef56605e206b2260fe9b2777c73
--- /dev/null
+++ b/appengine/findit/crash/test/culprit_test.py
@@ -0,0 +1,38 @@
+# 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.culprit import Culprit
+from crash.test.crash_testcase import CrashTestCase
+
+
+class CulpritTest(CrashTestCase):
+
+ def testFieldsProperty(self):
+ culprit = Culprit('', [], [], None, None)
+ self.assertEqual(culprit.fields, ('project', 'components', 'cls',
wrengr 2016/10/31 23:48:35 N.B., this is fragile. In general Culprit is not d
Sharu Jiang 2016/11/01 23:54:09 Actually we can still get suspected_project and su
wrengr 2016/11/03 16:14:33 No, FindCulprit should return None (or rather: not
+ 'regression_range', 'algorithm'))
+ def testToDicts(self):
+ culprit = Culprit(None, None, None, None, None)
wrengr 2016/10/31 23:48:35 Again, this is fragile. Culprit expects all the fi
Sharu Jiang 2016/11/01 23:54:09 Still, it's possible that some of those fields are
wrengr 2016/11/03 16:14:33 No, again. The Culprit class is defined to encapsu
+ self.assertTupleEqual(culprit.ToDicts(),
+ ({'found': False},
+ {'found_suspects': False,
+ 'found_project': False,
+ 'found_components': False,
+ 'has_regression_range': False,
+ 'solution': None}))
+
+ cl = self.GetDummyChangeLog()
wrengr 2016/10/31 23:48:35 Below from here should be broken out into a separa
+ culprit = Culprit('proj', ['comp'], [cl], ['50.0.1234.1', '50.0.1234.2'],
+ 'core_algorithm')
+ self.assertTupleEqual(culprit.ToDicts(),
+ ({'found': True,
+ 'regression_range': ['50.0.1234.1', '50.0.1234.2'],
+ 'suspected_project': 'proj',
+ 'suspected_components': ['comp'],
+ 'suspected_cls': [cl.ToDict()]},
+ {'found_suspects': True,
+ 'found_project': True,
+ 'found_components': True,
+ 'has_regression_range': True,
+ 'solution': 'core_algorithm'}))

Powered by Google App Engine
This is Rietveld 408576698