OLD | NEW |
| (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 unittest | |
6 | |
7 from dashboard.pinpoint import mann_whitney_u | |
8 | |
9 | |
10 class MannWhitneyUTest(unittest.TestCase): | |
11 def testBasic(self): | |
12 self.assertAlmostEqual( | |
13 mann_whitney_u.MannWhitneyU(range(10), range(20, 30)), | |
14 0.00018267179110955002) | |
15 self.assertAlmostEqual( | |
16 mann_whitney_u.MannWhitneyU(range(5), range(10)), | |
17 0.13986357686781267) | |
18 | |
19 def testDuplicateValues(self): | |
20 self.assertAlmostEqual(mann_whitney_u.MannWhitneyU([0] * 5, [1] * 5), | |
21 0.0039767517097886512) | |
22 | |
23 def testSmallSamples(self): | |
24 self.assertEqual(mann_whitney_u.MannWhitneyU([0], [1]), 1.0) | |
25 | |
26 def testAllValuesIdentical(self): | |
27 with self.assertRaises(ValueError): | |
28 mann_whitney_u.MannWhitneyU([0] * 5, [0] * 5) | |
29 | |
30 | |
31 if __name__ == '__main__': | |
32 unittest.main() | |
OLD | NEW |