OLD | NEW |
(Empty) | |
| 1 # Copyright 2014 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 unittest |
| 6 |
| 7 import bisect_results |
| 8 import ttest |
| 9 |
| 10 |
| 11 class ConfidenceScoreTest(unittest.TestCase): |
| 12 |
| 13 def testConfidenceScoreIsZeroOnTooFewLists(self): |
| 14 self.assertEqual(bisect_results.ConfidenceScore([], [[1], [2]]), 0.0) |
| 15 self.assertEqual(bisect_results.ConfidenceScore([[1], [2]], []), 0.0) |
| 16 self.assertEqual(bisect_results.ConfidenceScore([[1]], [[1], [2]]), 0.0) |
| 17 self.assertEqual(bisect_results.ConfidenceScore([[1], [2]], [[1]]), 0.0) |
| 18 |
| 19 def testConfidenceScoreIsZeroOnEmptyLists(self): |
| 20 self.assertEqual(bisect_results.ConfidenceScore([[], []], [[1], [2]]), 0.0) |
| 21 self.assertEqual(bisect_results.ConfidenceScore([[1], [2]], [[], []]), 0.0) |
| 22 |
| 23 def testConfidenceScoreIsUsingTTestWelchsTTest(self): |
| 24 original_WelchsTTest = ttest.WelchsTTest |
| 25 try: |
| 26 ttest.WelchsTTest = lambda _sample1, _sample2: (0, 0, 0.42) |
| 27 self.assertAlmostEqual( |
| 28 bisect_results.ConfidenceScore([[1], [1]], [[2], [2]]), 58.0) |
| 29 finally: |
| 30 ttest.WelchsTTest = original_WelchsTTest |
| 31 |
| 32 |
| 33 class BisectResulstsTest(unittest.TestCase): |
| 34 # TODO(sergiyb): Write tests for GetResultDicts when it is broken into smaller |
| 35 # pieces. |
| 36 pass |
| 37 |
| 38 |
| 39 if __name__ == '__main__': |
| 40 unittest.main() |
OLD | NEW |