Пример #1
0
 def setUp(self):
     # tests are run from tests.py
     with open(
             os.path.join(os.getcwd(), 'recipe_scrapers', 'tests',
                          'test_data',
                          'epicurious.testhtml')) as file_opened:
         self.harvester_class = Epicurious(file_opened, test=True)
Пример #2
0
class TestEpicurious(unittest.TestCase):
    def setUp(self):
        # tests are run from tests.py
        with open(
                os.path.join(os.getcwd(), 'recipe_scrapers', 'tests',
                             'test_data',
                             'epicurious.testhtml')) as file_opened:
            self.harvester_class = Epicurious(file_opened, test=True)

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

    def test_title(self):
        self.assertEqual(
            self.harvester_class.title(),
            'Ramen Noodle Bowl with Escarole and Spicy Tofu Crumbles ')

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

    def test_ingredients(self):
        self.assertCountEqual([
            '2 (5.5-ounce) servings fresh or dried ramen noodles',
            '4 cups torn escarole', '3 tablespoons Roasted Garlic Chili Sauce',
            'Kosher salt', '4 Pickled Scallions',
            'Spicy Tofu Crumbles, thinly sliced radish, and chopped peanuts (for serving)'
        ], self.harvester_class.ingredients())

    def test_instructions(self):
        return self.assertEqual(
            'Cook noodles according to package directions. During the last minute of cooking, add escarole. Drain and rinse under cold water.\nToss noodles, escarole, and chili sauce in a large bowl until coated; season with salt. Divide noodles between bowls. Slice scallions into 1" pieces and place on top of noodles along with some tofu crumbles, radishes, and peanuts.',
            self.harvester_class.instructions())
Пример #3
0
 def setUp(self):
     # tests are run from tests.py
     with open(
             os.path.join(os.path.dirname(os.path.realpath(__file__)),
                          'test_data',
                          'epicurious.testhtml')) as file_opened:
         self.harvester_class = Epicurious(file_opened, test=True)
Пример #4
0
class TestEpicurious(unittest.TestCase):
    def setUp(self):
        # tests are run from tests.py
        with open(os.path.join(
            os.getcwd(),
            'recipe_scrapers',
            'tests',
            'test_data',
            'epicurious.html'
        )) as file_opened:
            self.harvester_class = Epicurious(file_opened, test=True)

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

    def test_title(self):
        self.assertEqual(
            self.harvester_class.title(),
            'Poached Eggs in Tomato Sauce with Chickpeas and Feta'
        )

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

    def test_ingredients(self):
        self.assertListEqual(
            [
                '1/4 cup olive oil',
                '1 medium onion, finely chopped',
                '4 garlic cloves, coarsely chopped',
                '2 jalapeños, seeded, finely chopped',
                '1 15-ounce can chickpeas, drained',
                '2 teaspoons Hungarian sweet paprika',
                '1 teaspoon ground cumin',
                '1 28-ounce can whole peeled tomatoes, crushed by hand, juices reserved',
                'Kosher salt and freshly ground black pepper',
                '1 cup coarsely crumbled feta',
                '8 large eggs',
                '1 tablespoon chopped flat-leaf parsley',
                '1 tablespoon chopped fresh cilantro',
                'Warm pita bread'
            ],
            self.harvester_class.ingredients()
        )

    def test_instructions(self):
        return self.assertEqual(
            'Preheat oven to 425°F. Heat oil in a large ovenproof skillet over medium-high heat. Add onion, garlic, and jalapeños; cook, stirring occasionally, until onion is soft, about 8 minutes. Add chickpeas, paprika, and cumin and cook for 2 minutes longer.\nAdd crushed tomatoes and their juices. Bring to a boil, reduce heat to medium-low, and simmer, stirring occasionally, until sauce thickens slightly, about 15 minutes. Season to taste with salt and pepper. Sprinkle feta evenly over sauce. Crack eggs one at a time and place over sauce, spacing evenly apart. Transfer skillet to oven and bake until whites are just set but yolks are still runny, 5-8 minutes. Garnish with parsley and cilantro. Serve with pita for dipping.\nPer serving: 358 calories, 22 g fat, 22 g carbohydrates\nNutritional analysis provided by Bon Appétit',
            self.harvester_class.instructions()
        )
Пример #5
0
class TestEpicurious(unittest.TestCase):
    def setUp(self):
        # tests are run from tests.py
        with open(os.path.join(
            os.getcwd(),
            'recipe_scrapers',
            'tests',
            'test_data',
            'epicurious.testhtml'
        )) as file_opened:
            self.harvester_class = Epicurious(file_opened, test=True)

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

    def test_title(self):
        self.assertEqual(
            self.harvester_class.title(),
            'Ramen Noodle Bowl with Escarole and Spicy Tofu Crumbles '
        )

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

    def test_ingredients(self):
        self.assertCountEqual(
            [
                '2 (5.5-ounce) servings fresh or dried ramen noodles',
                '4 cups torn escarole',
                '3 tablespoons Roasted Garlic Chili Sauce',
                'Kosher salt',
                '4 Pickled Scallions',
                'Spicy Tofu Crumbles, thinly sliced radish, and chopped peanuts (for serving)'
            ],
            self.harvester_class.ingredients()
        )

    def test_instructions(self):
        return self.assertEqual(
            'Cook noodles according to package directions. During the last minute of cooking, add escarole. Drain and rinse under cold water.\nToss noodles, escarole, and chili sauce in a large bowl until coated; season with salt. Divide noodles between bowls. Slice scallions into 1" pieces and place on top of noodles along with some tofu crumbles, radishes, and peanuts.',
            self.harvester_class.instructions()
        )

    def test_ratings(self):
        return self.assertGreaterEqual(self.harvester_class.ratings(), 0.99)

    def test_reviews(self):
        print(self.harvester_class.reviews()[0]['review_text'])
        self.assertCountEqual(
            "This was yummy, the tofu especially.  The sauce for the tofu really made the dish.  In light of that, I'd like to try this again with rice noodles instead of ramen and chicken instead of tofu.  I didn't really dig the fresh ramen as much as I thought I would (too eggy).  I'm not sure chicken will work quite so well as the tofu but it's worth a shot. lisamichellek from Seattle, WA",
            self.harvester_class.reviews()[0]['review_text'])

        self.assertEqual(self.harvester_class.reviews()[0]['rating'], 4)
Пример #6
0
 def setUp(self):
     # tests are run from tests.py
     with open(os.path.join(
         os.getcwd(),
         'recipe_scrapers',
         'tests',
         'test_data',
         'epicurious.html'
     )) as file_opened:
         self.harvester_class = Epicurious(file_opened, test=True)