Exemple #1
0
 def testZeroMedian_ResultProperties(self):
     nums = [3.4, 8, 100.2, 78, 3, -4, 12, 3.14, 1024]
     zeroed_nums = find_change_points._ZeroMedian(nums)
     # The output of _ZeroMedian has the same standard deviation as the input.
     self.assertEqual(math_utils.StandardDeviation(nums),
                      math_utils.StandardDeviation(zeroed_nums))
     # Also, the median of the output is always zero.
     self.assertEqual(0, math_utils.Median(zeroed_nums))
 def testZeroMedian_ResultProperties(self):
   nums = [3.4, 8, 100.2, 78, 3, -4, 12, 3.14, 1024]
   zeroed_nums = find_change_points._ZeroMedian(nums)
   # The output of _ZeroMedian has the same standard deviation as the input.
   self.assertEqual(
       math_utils.StandardDeviation(nums),
       math_utils.StandardDeviation(zeroed_nums))
   # Also, the median of the output is always zero.
   self.assertEqual(0, math_utils.Median(zeroed_nums))
Exemple #3
0
 def testZeroMedian_ReturnsValuesWithMedianEqualToZero(self):
     # The _ZeroMedian function adjusts values so that the median is zero.
     self.assertEqual([0, 0, 1], find_change_points._ZeroMedian([1, 1, 2]))
     self.assertEqual([-0.5, 0.5], find_change_points._ZeroMedian([45, 46]))
 def testZeroMedian(self):
   """The _ZeroMedian function adjusts values so that the median is zero."""
   self.assertEqual([0, 0, 1], find_change_points._ZeroMedian([1, 1, 2]))
   self.assertEqual([-0.5, 0.5], find_change_points._ZeroMedian([45, 46]))
 def testZeroMedian_ReturnsValuesWithMedianEqualToZero(self):
   # The _ZeroMedian function adjusts values so that the median is zero.
   self.assertEqual([0, 0, 1], find_change_points._ZeroMedian([1, 1, 2]))
   self.assertEqual([-0.5, 0.5], find_change_points._ZeroMedian([45, 46]))
 def testZeroMedian(self):
     """The _ZeroMedian function adjusts values so that the median is zero."""
     self.assertEqual([0, 0, 1], find_change_points._ZeroMedian([1, 1, 2]))
     self.assertEqual([-0.5, 0.5], find_change_points._ZeroMedian([45, 46]))