Пример #1
0
 def test_when_list_random_size_random_k(self):
     a = sample(range(100), 100)
     self.assertIn(select(a, randrange(0, len(a))), a)
Пример #2
0
 def test_when_list_random_size_all_elements_equal(self):
     x = randint(-100, 100)
     a = [x] * randint(1, 100)
     self.assertEqual(select(a, randint(0, len(a) - 1)), x)
Пример #3
0
 def test_when_list_size_2_k_is_zero(self):
     self.assertEqual(select([7, 5], 0), 5)
     self.assertEqual(select([5, 7], 0), 5)
Пример #4
0
 def test_when_list_random_size_k_is_zero(self):
     a = [randint(-100, 100) for _ in range(randint(3, 100))]
     self.assertEqual(select(a, 0), min(a))
Пример #5
0
 def test_when_list_size_1_k_is_zero(self):
     self.assertEqual(select([7], 0), 7)