add test for median with an even number of values

This commit is contained in:
Jeremy Carbaugh 2011-09-14 13:23:22 -04:00
parent 7e7893109a
commit 42213ff106

View File

@ -19,10 +19,16 @@ class StatsTestCase(unittest.TestCase):
self.assertEqual(fltr.value(), 36.0) self.assertEqual(fltr.value(), 36.0)
def test_median(self): def test_median(self):
# odd number of values
fltr = Median('a') fltr = Median('a')
list(fltr.attach(self._simple_data())) list(fltr.attach(self._simple_data()))
self.assertEqual(fltr.value(), 1) self.assertEqual(fltr.value(), 1)
# even number of values
fltr = Median('a')
list(fltr.attach(self._simple_data()[:2]))
self.assertEqual(fltr.value(), 3)
def test_minmax(self): def test_minmax(self):
fltr = MinMax('b') fltr = MinMax('b')
list(fltr.attach(self._simple_data())) list(fltr.attach(self._simple_data()))