def test_median(self): # медиана для четного количества self.assertEqual(log_analyzer.median([1, 2, 3, 4, 5]), 3) # медиана для нечетного количества self.assertEqual(log_analyzer.median([1, 2, 4, 5]), 3) # медиана для одного значения self.assertEqual(log_analyzer.median([1]), 1)
def test_median(self): # median of even list self.assertEqual(log_analyzer.median([1, 2, 3, 4, 5]), 3) # median of odd list self.assertEqual(log_analyzer.median([1, 2, 4, 5]), 3) # median of list with single element self.assertEqual(log_analyzer.median([1]), 1)
def test_median(self): """test log_analyzer.median""" self.assertEqual(la.median([1, 2, 3, 4, 5]), 3) self.assertEqual(la.median([1, 2, 3, 4, 5, 6]), 3.5) self.assertNotEqual(la.median([1, 2, 3, 4, 5]), 5) self.assertNotEqual(la.median([1, 2, 3, 4, 5, 6]), 4.5) self.assertEqual(la.median(sorted([3, 2, 1, 4, 5])), 3)
def testMedian(self): t = [1, 1, 2, 3] median = log_analyzer.median(t) self.assertAlmostEqual(median, 1.5, places=2) t = [1, 2, 3] median = log_analyzer.median(t) self.assertAlmostEqual(median, 2, places=2) t = [1.1, 2.2, 2.3, 3.8] median = log_analyzer.median(t) self.assertAlmostEqual(median, 2.25, places=2)
def test_median(self): self.assertEqual(log_analyzer.median([1, 2, 3]), 2)
def test_median(self): self.assertEqual(log_analyzer.median([5, 17, 3, 9, 14, 2]), 7) self.assertEqual(log_analyzer.median([5, 2, 18, 8, 3]), 5)
def test_median_for_an_empty_list(self): data = [] self.assertIsNone(log_analyzer.median(data))
def test_median_for_one_item(self): data = [6] self.assertEqual(log_analyzer.median(data), 6)
def test_median_for_two_items(self): data = [15, 33] self.assertEqual(log_analyzer.median(data), 24)
def test_median_for_an_odd_number_of_items(self): data = [7, 10, 22, 3, 1, 1, 15] self.assertEqual(log_analyzer.median(data), 7)
def test_median_for_an_even_number_of_items(self): data = [1, 12, 4, 15, 3, 2] self.assertAlmostEqual(log_analyzer.median(data), 3.5)
def test_median(self): self.assertEqual(log_analyzer.median([1, 1, 1, 7, 5, 8, 1, 0, 0, 0, 5, 6, 10, 100]), 3)
def test_median(self): self.assertEqual(log_analyzer.median([1,2,3,4,5,6]), 3.5)
def test_median(self): result = lg.median([1256, 3, 43, 76, 56]) self.assertEqual(56, result)