Exemplo n.º 1
0
    def test_categorize_dish(self):
        test_data = zip(sorted(recipes_without_duplicates, reverse=True)[::3], dishes_categorized[::3])

        for variant, (item, result)  in enumerate(test_data, start=1):
            with self.subTest(f"variation #{variant}", item=item, result=result):
                error_message = f"Exptected category {result} for {item[0]}, but got a different category instead."
                self.assertEqual(categorize_dish(item[1], item[2]), (result), msg=error_message)
Exemplo n.º 2
0
    def test_categorize_dish(self):
        input_data = sorted(recipes_without_duplicates, reverse=True)
        result_data = dishes_categorized
        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(categorize_dish(item[1], item[2]), (result))