From 57e92801041424ec5d2d424109762200f30fa796 Mon Sep 17 00:00:00 2001 From: Swapnil Kulkarni Date: Wed, 9 Jul 2014 07:23:52 +0000 Subject: [PATCH] Add unit tests for processing utils Added following unit tests test_percentile_value_none test_percentile_equal Change-Id: I772bcfae418722371b7abcd525fcf913aef1e01e Implements: blueprint improve-unit-test-coverage-rally --- tests/benchmark/processing/test_utils.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/benchmark/processing/test_utils.py b/tests/benchmark/processing/test_utils.py index 4afff4473c..c4c160967c 100644 --- a/tests/benchmark/processing/test_utils.py +++ b/tests/benchmark/processing/test_utils.py @@ -23,12 +23,21 @@ class ProcessingUtilsTestCase(test.TestCase): def test_percentile(self): lst = range(1, 101) result = utils.percentile(lst, 0.1) - self.assertTrue(result == 10.9) + self.assertEqual(result, 10.9) + + def test_percentile_value_none(self): + result = utils.percentile(None, 0.1) + self.assertEqual(result, None) + + def test_percentile_equal(self): + lst = range(1, 101) + result = utils.percentile(lst, 1) + self.assertEqual(result, 100) def test_mean(self): lst = range(1, 100) result = utils.mean(lst) - self.assertTrue(result == 50.0) + self.assertEqual(result, 50.0) def test_mean_empty_list(self): lst = []