コード例 #1
0
class TestMyBakingAddictionScraper(unittest.TestCase):
    def setUp(self):
        # tests are run from tests.py
        with open(
                os.path.join(os.getcwd(), 'recipe_scrapers', 'tests',
                             'test_data',
                             'mybakingaddiction.testhtml')) as file_opened:
            self.harvester_class = MyBakingAddiction(file_opened, test=True)

    def test_host(self):
        self.assertEqual('mybakingaddiction.com', self.harvester_class.host())

    def test_title(self):
        self.assertEqual(self.harvester_class.title(), 'Cheesecake in a Jar')

    def test_total_time(self):
        self.assertEqual(0, self.harvester_class.total_time())

    def test_ingredients(self):
        self.assertCountEqual([
            '½ cup plus 2 tablespoons granulated sugar', 'zest of one lemon',
            '2 packages cream cheese, 8 oz each; room temperature',
            '2 large eggs; room temperature', '¼ cup heavy cream',
            '1 ½ teaspoons pure vanilla extract', '1 cup fresh berries'
        ], self.harvester_class.ingredients())

    def test_instructions(self):
        return self.assertEqual(
            'Preheat oven to 350°F.\nBegin to boil a large pot of water for the water bath.\nIn the bowl of your stand mixer fitted with your paddle attachment, combine the sugar and lemon zest and mix until the sugar is moistened and fragrant.\nAdd in the cream cheese and cream together until smooth.\nAdd eggs, one at a time, fully incorporating each before adding the next. Make sure to scrape down the bowl in between each egg.\nAdd heavy cream and vanilla and mix until smooth.\nPour batter into canning jars until about ¾ of the way full.\nPlace jars into a larger pan and pour boiling water into the larger pan until halfway up the sides of the jars.\nBake 25 to 30 minutes, the edges will appear to be set, but the center will still have a little jiggle to it.\nCarefully remove the cheesecake jars from the water bath and place on a cooling rack to cool completely.\nOnce the cheesecakes are completely cooled, place them into the refrigerator for at least 5 hours.\nTop will fresh berries and serve.',
            self.harvester_class.instructions())
コード例 #2
0
class TestMyBakingAddictionScraper(unittest.TestCase):
    def setUp(self):
        # tests are run from tests.py
        with open(
                os.path.join(os.getcwd(), 'recipe_scrapers', 'tests',
                             'test_data',
                             'mybakingaddiction.testhtml')) as file_opened:
            self.harvester_class = MyBakingAddiction(file_opened, test=True)

    def test_host(self):
        self.assertEqual('mybakingaddiction.com', self.harvester_class.host())

    def test_title(self):
        self.assertEqual(self.harvester_class.title(), 'Pumpkin Roll')

    def test_total_time(self):
        self.assertEqual(40, self.harvester_class.total_time())

    def test_ingredients(self):
        self.assertCountEqual([
            '2/3 cup pure pumpkin puree', '3 large eggs',
            '1 cup powdered sugar, sifted', '1/2 teaspoon baking soda',
            '1/4 teaspoon salt', 'For the Filling',
            '1/4 cup powdered sugar (to sprinkle on towel)',
            '1 (8 ounce) package cream cheese, softened',
            '1 tablespoon pumpkin pie spice', '1/2 teaspoon baking powder',
            '1 teaspoon vanilla extract', '6 tablespoons butter, softened',
            '1 cup granulated sugar', '3/4 cup all-purpose flour',
            '1 teaspoon pure vanilla extract', 'For the Cake'
        ], self.harvester_class.ingredients())

    def test_instructions(self):
        return self.assertEqual(
            'Preheat oven to 375°F. Line a 15 x 10-inch jelly-roll pan with parchment paper and spray with non-stick cooking spray. Sprinkle a clean tea towel with powdered sugar. Set pan and towel aside.\nIn a medium bowl, combine flour, baking powder, baking soda, pumpkin pie spice and salt.\nIn a large bowl with an electric mixer, beat eggs, vanilla and sugar until thick.\nAdd in pumpkin and mix to combine.\nStir in flour mixture.\nSpread batter evenly into prepared pan.\nBake for 13 to 15 minutes or until top of cake springs back when touched.\nImmediately loosen and turn cake onto prepared towel. Carefully peel off paper. Roll up cake and towel together, starting with narrow end. Cool on wire rack.\nIn a medium bowl, beat cream cheese, powdered sugar, butter and vanilla extract until smooth.\nCarefully unroll cake; remove towel.\nSpread cream cheese mixture over cake. Reroll cake.\nWrap in plastic wrap and refrigerate at least one hour.',
            self.harvester_class.instructions())
コード例 #3
0
class TestMyBakingAddictionScraper(unittest.TestCase):
    def setUp(self):
        # tests are run from tests.py
        with open(os.path.join(
            os.getcwd(),
            'recipe_scrapers',
            'tests',
            'test_data',
            'mybakingaddiction.html'
        )) as file_opened:
            self.harvester_class = MyBakingAddiction(file_opened, test=True)

    def test_host(self):
        self.assertEqual(
            'mybakingaddiction.com',
            self.harvester_class.host()
        )

    def test_title(self):
        self.assertEqual(
            self.harvester_class.title(),
            'Cheesecake in a Jar'
        )

    def test_total_time(self):
        self.assertEqual(
            0,
            self.harvester_class.total_time()
        )

    def test_ingredients(self):
        self.assertListEqual(
            [
                '½ cup plus 2 tablespoons granulated sugar',
                'zest of one lemon',
                '2 packages cream cheese, 8 oz each; room temperature',
                '2 large eggs; room temperature',
                '¼ cup heavy cream',
                '1 ½ teaspoons pure vanilla extract',
                '1 cup fresh berries'
            ],
            self.harvester_class.ingredients()
        )

    def test_instructions(self):
        return self.assertEqual(
            'Preheat oven to 350°F.\nBegin to boil a large pot of water for the water bath.\nIn the bowl of your stand mixer fitted with your paddle attachment, combine the sugar and lemon zest and mix until the sugar is moistened and fragrant.\nAdd in the cream cheese and cream together until smooth.\nAdd eggs, one at a time, fully incorporating each before adding the next. Make sure to scrape down the bowl in between each egg.\nAdd heavy cream and vanilla and mix until smooth.\nPour batter into canning jars until about ¾ of the way full.\nPlace jars into a larger pan and pour boiling water into the larger pan until halfway up the sides of the jars.\nBake 25 to 30 minutes, the edges will appear to be set, but the center will still have a little jiggle to it.\nCarefully remove the cheesecake jars from the water bath and place on a cooling rack to cool completely.\nOnce the cheesecakes are completely cooled, place them into the refrigerator for at least 5 hours.\nTop will fresh berries and serve.',
            self.harvester_class.instructions()
        )
コード例 #4
0
class TestMyBakingAddictionScraper(unittest.TestCase):
    def setUp(self):
        # tests are run from tests.py
        with open(
                os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             'test_data',
                             'mybakingaddiction.testhtml')) as file_opened:
            self.harvester_class = MyBakingAddiction(file_opened, test=True)

    def test_host(self):
        self.assertEqual('mybakingaddiction.com', self.harvester_class.host())

    def test_image(self):
        self.assertEqual(
            'https://www.mybakingaddiction.com/wp-content/uploads/2016/08/chocolate-coconut-zucchini-bread-1-of-11-1-600x900.jpg',
            self.harvester_class.image())

    def test_title(self):
        self.assertEqual(self.harvester_class.title(),
                         'Chocolate Coconut Zucchini Bread')

    def test_ratings(self):
        self.assertEqual(self.harvester_class.ratings(), 4.4)

    def test_total_time(self):
        self.assertEqual(75, self.harvester_class.total_time())

    def test_yields(self):
        self.assertEqual("2 serving(s)", self.harvester_class.yields())

    def test_ingredients(self):
        self.assertCountEqual([
            '2 1/2 cups all-purpose flour', '1/2 cup unsweetened cocoa powder',
            '1 teaspoon salt', '1 teaspoon baking soda',
            '1/2 teaspoon baking powder', '1 teaspoon ground cinnamon',
            '1 cup CRISCO® Organic Refined Coconut Oil, melted',
            '2/3 cup granulated sugar', '2/3 cup light brown sugar',
            '1/2 cup sour cream', '3 large eggs',
            '2 teaspoons pure vanilla extract', '2 1/2 cups grated zucchini',
            '1 cup semi-sweet chocolate chips',
            '3/4 cup shredded sweetened coconut'
        ], self.harvester_class.ingredients())

    def test_instructions(self):
        return self.assertEqual(
            'Preheat oven to 350°F. Spray two 8x4-inch loaf pans with Pillsbury® Baking Spray with Flour.\nIn a medium bowl, sift together the flour, cocoa, salt, baking soda, baking powder and cinnamon.\nIn a large bowl with an electric mixer, mix the coconut oil and sugars until combined. Mix in the sour cream. Add in the eggs and vanilla and mix until thoroughly incorporated.\nSlowly add dry ingredients to wet ingredients and mix until just combined.\nAdd in the zucchini and mix for about 1 minute, or until the batter is moistened and the zucchini is evenly incorporated into the batter. Stir in the chocolate chips and shredded coconut.\nSpread the batter into the prepared pans and bake in preheated oven for 55-60 minutes, or until a toothpick inserted into the center comes out clean.\nCool bread in pan for 1/2 hour. Remove bread to a wire rack to cool completely.',
            self.harvester_class.instructions())