def test_find_my_friend_start_of_queue(self): params = (["Natasha", "Steve", "Tchalla", "Wanda", "Rocket"], "Natasha") result = 0 self.assertEqual( find_my_friend(*params), result, msg="The index of the friend to find is incorrect." )
def test_find_my_friend_middle_of_queue(self): params = (["Natasha", "Steve", "Tchalla", "Wanda", "Rocket"], "Steve") result = 1 self.assertIs(find_my_friend(*params), result, msg="The index of the friend to find is incorrect")
def test_find_my_friend(self): data = [ ((['Natasha', 'Steve', 'Tchalla', 'Wanda', 'Rocket'], 'Natasha'), 0), ((['Natasha', 'Steve', 'Tchalla', 'Wanda', 'Rocket'], 'Steve'), 1), ((['Natasha', 'Steve', 'Tchalla', 'Wanda', 'Rocket'], 'Rocket'), 4), ] error_message = 'The index of the friend to find is incorrect.' for variant, (params, result) in enumerate(data, start=1): with self.subTest(f'variation #{variant}', input=params, output=result): self.assertIs(find_my_friend(*params), result, msg=error_message)
def test_find_my_friend(self): data = [ ((["Natasha", "Steve", "Tchalla", "Wanda", "Rocket"], "Natasha"), 0), ((["Natasha", "Steve", "Tchalla", "Wanda", "Rocket"], "Steve"), 1), ((["Natasha", "Steve", "Tchalla", "Wanda", "Rocket"], "Rocket"), 4), ] error_message = "The index of the friend to find is incorrect." for variant, (params, result) in enumerate(data, start=1): with self.subTest(f"variation #{variant}", input=params, output=result): self.assertIs(find_my_friend(*params), result, msg=error_message)