Exemplo n.º 1
0
 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")
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    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)