From a1df2e81be07749ad01c30f55e6db007ffa3228e Mon Sep 17 00:00:00 2001 From: Patryk Toczko Date: Mon, 5 Sep 2022 11:42:12 -0400 Subject: [PATCH 1/8] Handle case where ingredients are in subheaders --- recipe_scrapers/greatbritishchefs.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/recipe_scrapers/greatbritishchefs.py b/recipe_scrapers/greatbritishchefs.py index d0a0ac914..277f9b80b 100644 --- a/recipe_scrapers/greatbritishchefs.py +++ b/recipe_scrapers/greatbritishchefs.py @@ -49,11 +49,15 @@ def image(self): return src if image else None def ingredients(self): - ingredientsOuter = self.soup.find( + ingredientsOuter = self.soup.findAll( "ul", {"class": "IngredientsList__ListContainer"} ) ingGroup = [] - ingredparts = ingredientsOuter.findAll("li") + ingredparts = [] + + for subheader in ingredientsOuter: + ingredparts.extend(subheader.findAll('li')) + for i in ingredparts: x = normalize_string(i.get_text()) ingGroup.append(x) From a575ed998cf2e7328da5427d2f725a6fa09c54d1 Mon Sep 17 00:00:00 2001 From: Patryk Toczko Date: Mon, 5 Sep 2022 14:11:16 -0400 Subject: [PATCH 2/8] Fix lint error --- recipe_scrapers/greatbritishchefs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe_scrapers/greatbritishchefs.py b/recipe_scrapers/greatbritishchefs.py index 277f9b80b..179807cd7 100644 --- a/recipe_scrapers/greatbritishchefs.py +++ b/recipe_scrapers/greatbritishchefs.py @@ -56,7 +56,7 @@ def ingredients(self): ingredparts = [] for subheader in ingredientsOuter: - ingredparts.extend(subheader.findAll('li')) + ingredparts.extend(subheader.findAll("li")) for i in ingredparts: x = normalize_string(i.get_text()) From 48d052d9dd7f3c703ef6efc295529b80c6baee88 Mon Sep 17 00:00:00 2001 From: Patryk Toczko Date: Mon, 5 Sep 2022 15:17:19 -0400 Subject: [PATCH 3/8] Rename original test --- ...{test_greatbritishchefs.py => test_greatbritishchefs_1.py} | 4 ++++ 1 file changed, 4 insertions(+) rename tests/{test_greatbritishchefs.py => test_greatbritishchefs_1.py} (96%) diff --git a/tests/test_greatbritishchefs.py b/tests/test_greatbritishchefs_1.py similarity index 96% rename from tests/test_greatbritishchefs.py rename to tests/test_greatbritishchefs_1.py index 011a05bea..2b6246035 100644 --- a/tests/test_greatbritishchefs.py +++ b/tests/test_greatbritishchefs_1.py @@ -6,6 +6,10 @@ class TestGreatBritishChefsScraper(ScraperTest): scraper_class = GreatBritishChefs + @property + def test_file_name(self): + return "{}_1".format(self.scraper_class.__name__.lower()) + def test_host(self): self.assertEqual("greatbritishchefs.com", self.harvester_class.host()) From da45b29d9f751f9a5c1fd1ce65ceca55bddb487d Mon Sep 17 00:00:00 2001 From: Patryk Toczko Date: Mon, 5 Sep 2022 15:17:38 -0400 Subject: [PATCH 4/8] Fix bug --- recipe_scrapers/greatbritishchefs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipe_scrapers/greatbritishchefs.py b/recipe_scrapers/greatbritishchefs.py index 179807cd7..77f3cc6e2 100644 --- a/recipe_scrapers/greatbritishchefs.py +++ b/recipe_scrapers/greatbritishchefs.py @@ -60,7 +60,8 @@ def ingredients(self): for i in ingredparts: x = normalize_string(i.get_text()) - ingGroup.append(x) + if x != "": # Some recipes include an empty li + ingGroup.append(x) return ingGroup def instructions(self): From e7bece45a786e882ae8c8f75a55b846a9a1f2435 Mon Sep 17 00:00:00 2001 From: Patryk Toczko Date: Mon, 5 Sep 2022 15:18:02 -0400 Subject: [PATCH 5/8] Add new test --- tests/test_data/greatbritishchefs_2.testhtml | 2174 ++++++++++++++++++ tests/test_greatbritishchefs_2.py | 74 + 2 files changed, 2248 insertions(+) create mode 100644 tests/test_data/greatbritishchefs_2.testhtml create mode 100644 tests/test_greatbritishchefs_2.py diff --git a/tests/test_data/greatbritishchefs_2.testhtml b/tests/test_data/greatbritishchefs_2.testhtml new file mode 100644 index 000000000..f426684eb --- /dev/null +++ b/tests/test_data/greatbritishchefs_2.testhtml @@ -0,0 +1,2174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Beef and Mushroom Lasagne Recipe - Great British Chefs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+
+ + + + + + + + + +
+
+ + + + + + + + +
+
+ + + + + + + +
+ + + +
+ + +
+ + + + +
+
+
+
+ + + + + + + + +
+ + + + + + +
+ + +
+
+ +
+
+ +
+

+ Beef and mushroom lasagne +

+
+ + + +
+
+ by +
+ + + +
+
+
+ +
+
+ + +
+
+ + +
+
+ + +
+ +
+ +
+
+ +
+
+ +
+ +
+
+ + +
+ +
+

PT2H15M

+

+
+ +
+ +
+ + +
+
+ +
+
+ + +
+ First published in 2015 +
+ +
+ +
+
+
Share recipe
+ + +
+ +
+
+ +
+
+
+ +
+
+ + + +
+ + + + +
+
+ + +
+
+ + +
+
+
+ +
+ +
+
+
+ + + +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+ + + + + +
+
+

There are few dishes as comforting as a big, bubbling lasagne, its sauce rising and popping as it emerges from the oven; golden at the edges and hot as hell. Then comes the wait, for one must hold off plunging the serving spoon through the cheesy crust, down into the forgiving, soft handkerchiefs of pasta below. The portion should be very obviously too large as it wobbles its way over the plate, and once down, the ragu should ooze gently from the sides; inviting and rich, nuggets of beef tumble from between the layers.

There is a balance to be struck, with lasagne, between the creamy béchamel and intensely savoury ragu. In this version, the base is beefy, with just a little pork to bring salty-sweetness. The béchamel is thick and savoury with that almost-brown-butter flavour and then - boom - the mushrooms. Four different kinds feature here, but if, for example, girolles are not in season, do feel free to mix up the combination. Don’t skip the dried porcini though, as the depth of flavour they bring is something special.

The lasagne may seem like a heavy dish, but serve it with a salad of soft butter lettuce leaves, some slivers of spring onion and a sharp vinaigrette, and you have something summery. Drink with a chilled red, like a light and juicy Barbara d’Asti.

+
+
+ + + +
+ + +
+
+
+
+
+

+ Ingredients +

+
+ +
+
+
+ + + + + + + + + + + + +
+
+

Metric

+
+
+
+
+

Imperial

+
+
+
+
+ + + + +
+ +
+
+
+

Lasagne

+
+ +
+

Ragu

+
+ +
+

Mushroom béchamel

+
+ +
+
+
+ +
+
+ +
+
+ +
+
save recipe
+
+ +
+ + + + + + +
+
+ + + + + + +
+
+
+ +
+
+
+
+ + +
+
+ + +
+
+
+ +
+ +
+
+
+ + + +
+
+ + +
+
+
+
+
+

+ Method +

+
+ +
+ + + + + + + +
+
+
+ +
+
+
+
+ 1 +
+
+ In a large saucepan, cook the mince and bacon pieces until the mince is browned. Remove from the pan and set aside +
+
+ +
+ +
+ + + + + + + + +
+ +
+
+
+
+
+ 2 +
+
+

Heat 2 tbsp of oil in the pan and cook the onions until soft but not coloured. Add back the meat, then splash in the wine and cook for 10 minutes or so, stirring occasionally. Add the tomatoes, bay leaf and some salt and pepper

+
+
+ +
+ +
+ + + + + + + + +
+ +
+
+
+
+
+ 3 +
+
+ Put a lid on the pan and allow to cook, stirring every now and then, for around 1 hour. After this time, remove the lid and allow to cook for another half an hour or so, until the ragu has thickened +
+
+ +
+ +
+ + + + + + + + +
+ +
+
+
+
+
+ 4 +
+
+ Pour boiling water onto the dried porcini and allow to rehydrate for 20 minutes. Heat 2 tbsp of oil in a frying pan and cook the girolles, closed cup mushrooms and chestnut mushrooms until soft. Add the sage, cook a few minutes more then set aside +
+
+ +
+ +
+ + + + + + + + +
+ +
+ +
+ +
+
+
+
+ 5 +
+
+ Drain the porcini, reserving the water. Add the water to the ragu sauce, chop the porcini and add them to the other mushrooms +
+
+ +
+ +
+ + + + + + + + +
+ +
+
+
+
+
+ 6 +
+
+ To make the béchamel, melt the butter and and add the flour to it. Cook, stirring all the time, until the flour mixture is a golden sandy colour +
+
+ +
+ +
+ + + + + + + + +
+ +
+
+
+
+
+ 7 +
+
+ In a separate saucepan, heat the milk until almost boiling. Add it, a ladleful at a time, into the flour and butter mixture, whisking until smooth with each addition. Do this until all the milk is added, then bring the sauce to the boil and cook for around 5 minutes or so, until the sauce has thickened. Season with salt and pepper, then add the mushrooms and set aside +
+
+ +
+ +
+ + + + + + + + +
+ +
+
+
+
+
+ 8 +
+
+ Preheat the oven to 180°C/gas mark 4 +
+
+ +
+ +
+ + + + + + + + +
+ +
+
+
+
+
+ 9 +
+
+ To assemble the lasagne, add a layer of ragu, then add a layer of pasta sheets. Spread over a very scant layer of mushroom béchamel, then another layer of pasta sheets, then another of ragu +
+
+ +
+ +
+ + + + + + + + +
+ +
+
+
+
+
+ 10 +
+
+ Add another very scant layer of béchamel, then pasta sheets, then continue repeating these steps until you get to the top. On the final layer of pasta sheets, add the remaining béchamel so that you have a nice thick layer. Grate the Parmesan cheese on top and bake for 30-40 minutes until golden and bubbling +
+
+ +
+ +
+ + + + + + + + +
+ +
+
+
+
+
+ 11 +
+
+ Serve with a green salad dressed with a sharp vinaigrette +
+
+ +
+ +
+ + + + + + + + +
+ +
+
+
+
+ + +
+ + + +
+ +
+
+ +
+ + +
+
+ +
+
+ + +
+
+ + +
+ First published in 2015 +
+
+ +
+
+
Share recipe
+ + +
+ +
+
+ +
+ + +
+ + +
+
+ + +
+
+
+ +
+ +
+
+
+ + +
+ + + +
+
+ + +
+
+
+ +
+ +
+
+
+ + + +
+
+ +
+
+ +
+ + +
+ +
+ + +
+
+

Get in touch

 
 
+
+
+ + + +
+ + + +
+ +
+ + + +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_greatbritishchefs_2.py b/tests/test_greatbritishchefs_2.py new file mode 100644 index 000000000..b998d1fca --- /dev/null +++ b/tests/test_greatbritishchefs_2.py @@ -0,0 +1,74 @@ +from recipe_scrapers.greatbritishchefs import GreatBritishChefs +from tests import ScraperTest + + +class TestGreatBritishChefsScraper(ScraperTest): + + scraper_class = GreatBritishChefs + + @property + def test_file_name(self): + return "{}_2".format(self.scraper_class.__name__.lower()) + + def test_host(self): + self.assertEqual("greatbritishchefs.com", self.harvester_class.host()) + + def test_canonical_url(self): + self.assertEqual( + "https://www.greatbritishchefs.com/recipes/beef-mushroom-lasagne-recipe", + self.harvester_class.canonical_url(), + ) + + def test_title(self): + self.assertEqual(self.harvester_class.title(), "Beef and mushroom lasagne") + + def test_total_time(self): + self.assertEqual(135, self.harvester_class.total_time()) + + def test_yields(self): + self.assertEqual("8", self.harvester_class.yields()) + + def test_image(self): + self.assertEqual( + "http:https://media-cdn.greatbritishchefs.com/media/mbqmodb5/img46675.jpg?mode=crop&width=768&height=512", + self.harvester_class.image(), + ) + + def test_ingredients(self): + self.assertCountEqual( + [ + "1 lasagne pasta, packet", + "50g of Parmesan", + "oil", + "2 onions, finely chopped", + "700g of beef mince", + "6 bacon rashers, diced", + "3 tin of chopped tomatoes", + "1 bay leaf", + "250ml of red wine", + "70g of butter", + "50g of plain flour", + "500ml of milk", + "200g of chestnut mushrooms, sliced", + "100g of button mushrooms, sliced", + "100g of girolles, sliced", + "1 handful of porcini mushroom", + "6 sage leaves" + ], + self.harvester_class.ingredients(), + ) + + def test_instructions(self): + return self.assertEqual( + "In a large saucepan, cook the mince and bacon pieces until the mince is browned. Remove from the pan and set aside\nHeat 2 tbsp of oil in the pan and cook the onions until soft but not coloured. Add back the meat, then splash in the wine and cook for 10 minutes or so, stirring occasionally. Add the tomatoes, bay leaf and some salt and pepper\nPut a lid on the pan and allow to cook, stirring every now and then, for around 1 hour. After this time, remove the lid and allow to cook for another half an hour or so, until the ragu has thickened\nPour boiling water onto the dried porcini and allow to rehydrate for 20 minutes. Heat 2 tbsp of oil in a frying pan and cook the girolles, closed cup mushrooms and chestnut mushrooms until soft. Add the sage, cook a few minutes more then set aside\nDrain the porcini, reserving the water. Add the water to the ragu sauce, chop the porcini and add them to the other mushrooms\nTo make the béchamel, melt the butter and and add the flour to it. Cook, stirring all the time, until the flour mixture is a golden sandy colour\nIn a separate saucepan, heat the milk until almost boiling. Add it, a ladleful at a time, into the flour and butter mixture, whisking until smooth with each addition. Do this until all the milk is added, then bring the sauce to the boil and cook for around 5 minutes or so, until the sauce has thickened. Season with salt and pepper, then add the mushrooms and set aside\nPreheat the oven to 180°C/gas mark 4\nTo assemble the lasagne, add a layer of ragu, then add a layer of pasta sheets. Spread over a very scant layer of mushroom béchamel, then another layer of pasta sheets, then another of ragu\nAdd another very scant layer of béchamel, then pasta sheets, then continue repeating these steps until you get to the top. On the final layer of pasta sheets, add the remaining béchamel so that you have a nice thick layer. Grate the Parmesan cheese on top and bake for 30-40 minutes until golden and bubbling\nServe with a green salad dressed with a sharp vinaigrette", + self.harvester_class.instructions(), + ) + + def test_ratings(self): + self.assertEqual(None, self.harvester_class.ratings()) + + def test_description(self): + self.assertEqual( + "Helen Graves adds an extra special twist to her traditional lasagne recipe with a richly flavoured mushroom béchamel. Good quality mince and slowly cooking the ragu for an hour ensure this comfort food classic ticks all the boxes.", + self.harvester_class.description(), + ) From f192a5e4476a5be4639c75a47808cc65c737f20d Mon Sep 17 00:00:00 2001 From: Patryk Toczko Date: Mon, 5 Sep 2022 15:18:19 -0400 Subject: [PATCH 6/8] Rename testhtml file --- .../{greatbritishchefs.testhtml => greatbritishchefs_1.testhtml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/test_data/{greatbritishchefs.testhtml => greatbritishchefs_1.testhtml} (100%) diff --git a/tests/test_data/greatbritishchefs.testhtml b/tests/test_data/greatbritishchefs_1.testhtml similarity index 100% rename from tests/test_data/greatbritishchefs.testhtml rename to tests/test_data/greatbritishchefs_1.testhtml From 281f3948df6995d04bfb0d8098ede7ac64dcc0b4 Mon Sep 17 00:00:00 2001 From: Patryk Toczko Date: Mon, 5 Sep 2022 15:43:26 -0400 Subject: [PATCH 7/8] Add trailing comma --- tests/test_greatbritishchefs_2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_greatbritishchefs_2.py b/tests/test_greatbritishchefs_2.py index b998d1fca..f27e18b2c 100644 --- a/tests/test_greatbritishchefs_2.py +++ b/tests/test_greatbritishchefs_2.py @@ -53,7 +53,7 @@ def test_ingredients(self): "100g of button mushrooms, sliced", "100g of girolles, sliced", "1 handful of porcini mushroom", - "6 sage leaves" + "6 sage leaves", ], self.harvester_class.ingredients(), ) From 41e462dbee1da7d3dc5e35d93b2dbc9f4eacca02 Mon Sep 17 00:00:00 2001 From: Patryk Toczko Date: Mon, 5 Sep 2022 15:45:45 -0400 Subject: [PATCH 8/8] Run black locally --- recipe_scrapers/greatbritishchefs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe_scrapers/greatbritishchefs.py b/recipe_scrapers/greatbritishchefs.py index 77f3cc6e2..6f853668e 100644 --- a/recipe_scrapers/greatbritishchefs.py +++ b/recipe_scrapers/greatbritishchefs.py @@ -60,7 +60,7 @@ def ingredients(self): for i in ingredparts: x = normalize_string(i.get_text()) - if x != "": # Some recipes include an empty li + if x != "": # Some recipes include an empty li ingGroup.append(x) return ingGroup