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

Side by Side Diff: appengine/findit/model/test/suspected_cl_confidence_test.py

Issue 2398903002: [Findit] Display confidence score on result page. (Closed)
Patch Set: . Created 4 years, 2 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 import datetime
6
7 from testing_utils import testing
8
9 from model.suspected_cl_confidence import ConfidenceInformation
10 from model.suspected_cl_confidence import SuspectedCLConfidence
11
12
13 class VersionedConfigTest(testing.AppengineTestCase):
14
15 def testConfidenceInformationToDict(self):
16 confidence_info = ConfidenceInformation(
17 correct=90, total=100, confidence=0.9, score=None)
18
19 expected_dict = {
20 'correct': 90,
21 'total': 100,
22 'confidence': 0.9
23 }
24 self.assertEqual(expected_dict, confidence_info.ToDict())
25
26 def testCreateNewSuspectedCLConfidenceIfNone(self):
27 self.assertIsNotNone(SuspectedCLConfidence.Get())
28
29 def testUpdateSuspectedCLConfidence(self):
30 cl_confidence = SuspectedCLConfidence.Get()
31 start_date = datetime.datetime(2016, 10, 06, 0, 0, 0)
32 end_date = datetime.datetime(2016, 10, 07, 0, 0, 0)
33 compile_heuristic = [ConfidenceInformation(
34 correct=100, total=100, confidence=1.0, score=5)]
35 compile_try_job = ConfidenceInformation(
36 correct=99, total=100, confidence=0.99, score=None)
37 compile_heuristic_try_job = ConfidenceInformation(
38 correct=98, total=100, confidence=0.98, score=None)
39 test_heuristic = [ConfidenceInformation(
40 correct=97, total=100, confidence=0.97, score=5)]
41 test_try_job = ConfidenceInformation(
42 correct=96, total=100, confidence=0.96, score=None)
43 test_heuristic_try_job = ConfidenceInformation(
44 correct=95, total=100, confidence=0.95, score=None)
45
46 cl_confidence.Update(
47 start_date, end_date, compile_heuristic, compile_try_job,
48 compile_heuristic_try_job, test_heuristic, test_try_job,
49 test_heuristic_try_job)
50 cl_confidence = SuspectedCLConfidence.Get()
51
52 self.assertEqual(compile_heuristic, cl_confidence.compile_heuristic)
53 self.assertEqual(compile_try_job, cl_confidence.compile_try_job)
54 self.assertEqual(
55 compile_heuristic_try_job, cl_confidence.compile_heuristic_try_job)
56 self.assertEqual(test_heuristic, cl_confidence.test_heuristic)
57 self.assertEqual(test_try_job, cl_confidence.test_try_job)
58 self.assertEqual(
59 test_heuristic_try_job, cl_confidence.test_heuristic_try_job)
OLDNEW
« no previous file with comments | « appengine/findit/model/suspected_cl_confidence.py ('k') | appengine/findit/templates/build_failure.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698