Exemple #1
0
 def test_with_multiple_same_nums_even(self):
     result = median([5, 5, 5, 2, 2, 2])
     self.assertIsInstance(result, tuple)
     self.assertEqual((2, 5), result)
Exemple #2
0
 def test_with_multiple_same_nums_even_floats(self):
     result = median([5.00, 5.00, 5.00, 2.00, 2.00, 2.00])
     self.assertIsInstance(result, tuple)
     self.assertEqual((2, 5), result)
Exemple #3
0
 def test_with_multiple_same_nums_odd(self):
     result = median([5, 5, 5, 2, 2])
     self.assertEqual(5, result)
Exemple #4
0
 def test_with_multiple_same_nums_odd_floats(self):
     result = median([5.00, 5.00, 5.00, 2.00, 2.00])
     self.assertEqual(5, result)
Exemple #5
0
 def test_with_odd_set_of_nums_unordered(self):
     result = median([4, 5, 1, 3, 2])
     self.assertEqual(3, result)
Exemple #6
0
 def test_with_sring_in_list_arg(self):
     with self.assertRaises(TypeError):
         median([1, 2, 'hello', 4])
Exemple #7
0
 def test_with_even_set_of_nums_unordered(self):
     result = median([4, 2, 1, 3])
     self.assertIsInstance(result, tuple)
     self.assertEqual((2, 3), result)
Exemple #8
0
 def test_with_odd_set_of_nums(self):
     result = median([1, 2, 3, 4, 5])
     self.assertEqual(3, result)
Exemple #9
0
 def test_with_even_set_of_nums(self):
     result = median([1, 2, 3, 4])
     self.assertEqual((2, 3), result)
Exemple #10
0
 def test_with_sring_arg(self):
     with self.assertRaises(TypeError):
         median('hello')
Exemple #11
0
 def test_with_1_num(self):
     result = median([5])
     self.assertEqual(result, 5)