示例#1
0
    def test_clean_ingredients(self):
        test_data = zip(recipes_with_duplicates[::3], recipes_without_duplicates[::3])

        for variant, (item, result) in enumerate(test_data, start=1):
            with self.subTest(f"variation #{variant}", item=item[0], result=result[1]):
                error_msg = f"Expected a cleaned ingredient list for {item[0]}, but the ingredients aren't cleaned as expected."
                self.assertEqual(clean_ingredients(item[0], item[1]), (result[1], result[2]), msg=error_msg)
示例#2
0
    def test_clean_ingredients(self):
        input_data =  recipes_with_duplicates
        result_data = recipes_without_duplicates
        number_of_variants = range(1, len(input_data) + 1)

        for variant, item, result  in zip(number_of_variants, input_data, result_data):
            with self.subTest(f"variation #{variant}", item=item, result=result):
                self.assertEqual(clean_ingredients(item[0], item[1]), (result[1], result[2]))