def testBasic(self): self.assertAlmostEqual( mann_whitney_u.MannWhitneyU(range(10), range(20, 30)), 0.00018267179110955002) self.assertAlmostEqual( mann_whitney_u.MannWhitneyU(range(5), range(10)), 0.13986357686781267)
def _CompareValues(values_a, values_b): if not (values_a and values_b): return _UNKNOWN try: p_value = mann_whitney_u.MannWhitneyU(values_a, values_b) except ValueError: return _UNKNOWN if p_value < _SIGNIFICANCE_LEVEL: return _DIFFERENT else: return _UNKNOWN
def _CompareResults(results_a, results_b): if len(results_a) == 0 or len(results_b) == 0: return _UNKNOWN try: p_value = mann_whitney_u.MannWhitneyU(results_a, results_b) except ValueError: return _UNKNOWN if p_value < _SIGNIFICANCE_LEVEL: return _DIFFERENT else: return _UNKNOWN
def testAllValuesIdentical(self): with self.assertRaises(ValueError): mann_whitney_u.MannWhitneyU([0] * 5, [0] * 5)
def testSmallSamples(self): self.assertEqual(mann_whitney_u.MannWhitneyU([0], [1]), 1.0)
def testDuplicateValues(self): self.assertAlmostEqual(mann_whitney_u.MannWhitneyU([0] * 5, [1] * 5), 0.0039767517097886512)