def test_invalid_input(self): with self.assertRaises(AssertionError): find_min(1) with self.assertRaises(AssertionError): find_min(type) with self.assertRaises(TypeError): find_min([1, 2, 'v', '3']) with self.assertRaises(AssertionError): find_min('12345')
def test_find_min_range(self): arr = range(10) self.assertEqual(find_min(arr), 0)
def test_find_min_random(self): arr = (10, 9, 1, 19, 1, 4, 5, 6, 8, -1, 11) self.assertEqual(find_min(arr), -1)
def test_find_min_set(self): arr = {2, 3, 2, 5} self.assertEqual(find_min(arr), 2)
def test_find_min_generator(self): arr = (i for i in range(5)) self.assertEqual(find_min(arr), 0)