Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: moves 'instructions' from mandatory-tests to optional-tests, #1211

Merged
merged 7 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion docs/how-to-develop-scraper.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ The generated json file will look something like this, with only the host field
"language": "",
"title": "",
"ingredients": "",
"instructions": "",
"instructions_list": "",
"total_time": "",
"yields": "",
Expand Down
1 change: 0 additions & 1 deletion generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def generate_scraper_test(class_name, host_name):
"language": "",
"title": "",
"ingredients": "",
"instructions": "",
"instructions_list": "",
"total_time": "",
"yields": "",
Expand Down
20 changes: 19 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"host",
"image",
"ingredients",
"instructions",
"instructions_list",
"language",
"site_name",
Expand All @@ -24,6 +23,7 @@

OPTIONAL_TESTS = [
"ingredient_groups",
"instructions",
"category",
"description",
"cook_time",
Expand Down Expand Up @@ -145,6 +145,24 @@ def test_func(self):
with self.subTest("ingredient_groups"):
self.assertEqual(sorted(actual.ingredients()), sorted(grouped))

if "instructions_list" in expect:
list_instructions_normalized = [
line.strip() for line in expect["instructions_list"] if line.strip()
]

string_instructions_normalized = [
instruction.strip()
for instruction in actual.instructions().split("\n")
if instruction.strip()
]

with self.subTest("instructions_list vs instructions comparison"):
self.assertEqual(
string_instructions_normalized,
list_instructions_normalized,
msg="The actual value for .instructions() did not match the value from instructions_list.",
)

return test_func


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"2-3 large handfuls of spinach",
"to serve: lots of pan-fried tofu cubes, toasted almonds, scallions, chive flowers (optional)"
],
"instructions": "Scoop a big spoonful of thick coconut cream from the top of the coconut milk can. Add it to a large pan over medium-high heat. When hot, stir in the garlic, onions, chile, and salt. Sauté for a couple minutes, just long enough for everything to soften up.\nAdd the remaining coconut milk, and the water, and bring to a simmer before adding the broccoli and spinach. Simmer just long enough for the broccoli to get tender throughout, 2 - 4 minutes.\nImmediately remove the soup from heat and puree with an immersion blender. Add more water if you feel the need to thin the soup out. Taste and add more salt if needed.\nServe sprinkled with tofu cubes, toasted almonds, and lots of scallions.",
"instructions_list": [
"Scoop a big spoonful of thick coconut cream from the top of the coconut milk can. Add it to a large pan over medium-high heat. When hot, stir in the garlic, onions, chile, and salt. Sauté for a couple minutes, just long enough for everything to soften up.",
"Add the remaining coconut milk, and the water, and bring to a simmer before adding the broccoli and spinach. Simmer just long enough for the broccoli to get tender throughout, 2 - 4 minutes.",
Expand Down
1 change: 0 additions & 1 deletion tests/test_data/15gram.be/fifteengram.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"zout",
"zwarte peper"
],
"instructions": "Breng een ruime pot gezouten water aan de kook voor de pasta.\nVerwarm de oven voor op 220°C en bedek een bakplaat met bakpapier.\nSchik de pompoenblokjes op de bakplaat en pers de knoflook erbij. Hussel door elkaar met olijfolie, zout en zwarte peper. Rooster in 20 min. gaar in de oven.\nVerhit een scheutje olijfolie in een pan op hoog vuur. Bak het gehakt in 6-8 min. Prak met een spatel in \"chunks\", het hoeft niet helemaal fijn te zijn.\nKook de pasta volgens de instructies op de verpakking.\nSchik de geroosterde pompoen in een blender of maatbeker en mix, samen met de zure room en de helft van de geraspte cheddar, tot een gladde saus. Proef en breng op smaak met extra zout of zwarte peper (zie tip).\nGiet de pasta af en schik opnieuw in de pot. Meng met de roomsaus en het gehakt. Stort in een ovenschaal en strooi de rest van de kaas erover. Gratineer nog 5-10 min. in de oven voor een mooi kaaskorstje.\nTIP: Geef de saus wat extra punch met paprikapoeder, chilivlokken of bouillon.",
"instructions_list": [
"Breng een ruime pot gezouten water aan de kook voor de pasta.",
"Verwarm de oven voor op 220°C en bedek een bakplaat met bakpapier.",
Expand Down
1 change: 0 additions & 1 deletion tests/test_data/750g.com/g750g.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"Sel",
"Piment d'Espelette"
],
"instructions": "Étape 1 : Cuisson des carottes\nDécoupez les carottes en rondelles et faites-les revenir à feu moyen à l'huile d'olive avec les graines de coriandre grossièrement concassées.\n\nDéglacez au jus d'orange.\n\nAjoutez la branche de thym ainsi que l'assaisonnement.\n\nLaissez cuire avec un couvercle une dizaine de minutes puis laissez refroidir. Étape 2 : Préparation de la salade\nRâpez les carottes.\n\nDans un saladier, mélangez les carottes râpées, les carottes cuites, le fenouil et les oranges en cubes.\n\nAjoutez la vinaigrette et mélangez.\n\nAjoutez la coriandre ciselée et le piment d'espelette.",
"instructions_list": [
"Étape 1 : Cuisson des carottes",
"Découpez les carottes en rondelles et faites-les revenir à feu moyen à l'huile d'olive avec les graines de coriandre grossièrement concassées.",
Expand Down
1 change: 0 additions & 1 deletion tests/test_data/aberlehome.com/aberlehome.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"1 egg",
"15g (1 tablespoon) whole milk"
],
"instructions": "Feed starter several hours before mixing dough and allow it to peak.\n\nSourdough Croissant Dough:\n\n1. Day 1: Mix the dough ingredients until a shaggy dough forms. Remove dough to a clean countertop and knead for a few minutes until a smooth dough forms. Form dough into a ball.\n\n2. Transfer dough to a large bowl and cover. Leave in a warm place (75°-78°F) to ferment for 4 hours, or until it looks slightly poofy.\n\n3. Cover and refrigerate dough overnight.\n\nButter Block:\n\n1. Day 2: Place cold butter on a sheet of parchment paper and sprinkle with the flour. Fold the ends of the parchment loosely to cover the butter and begin pounding the butter with a rolling pin until it begins to flatten. (Update: I find it's easier to measure and fold the parchment before placing the butter inside.)\n\n\n\n2. Use a measuring tape to form the parchment paper into a 6x8-inch rectangle pouch over the butter. Flip the pouch over to keep the edges closed. Then use a rolling pin and your fingers to evenly press the butter into the pouch to make a butter block. Chill if butter has begun to melt and looks greasy on the edges. If butter is still cold but very pliable when you bend the package, it is ready for the next step.\n\n\n\nLock in Butter Block:\n\n1. Remove dough from fridge and turn it out onto a lightly floured surface. Use your hands to begin to shape the dough into a rectangle and pinch the corners to shape them. Roll the dough into a 13x9-inch rectangle. \n\n2. Unwrap butter block and place in the center of your dough with a short side facing you.\n\n\n\n3. Bring the ends of the dough over the butter so they meet in the middle of the butter block, encasing the butter. Press every seam to seal so the butter does not escape during rolling. Brush away any loose flour with a pastry brush.\n\n\n\nFirst Lamination Fold (Book Fold):\n\n1. Turn the dough so the center seam is parallel to you. Use your rolling pin to gently pound the dough to lengthen it. Then roll to a 24x10-inch rectangle. Try to keep the edges and corners straight, and dust underneath with more flour as needed to prevent sticking.\n\n2. Fold the short ends of the rectangle inward to meet in the center (Update: meeting the edges together off-center is actually better). Then fold the new ends together like you're closing a book. Brush away any loose flour as you go.\n\n\n\n3. Wrap book in plastic wrap and refrigerate for 20 minutes.\n\nSecond Lamination Fold (Tri-Fold or Letter Fold):\n\n1. Place dough on your lightly floured surface again, this time with the fold facing you. Pound and roll to a 24x10-inch rectangle again.\n\n2. Fold the short ends of the rectangle in thirds this time, as if you are folding a letter. Brush away loose flour as you go. \n\n\n\n3. Wrap in plastic again, and chill for 1 hour.\n\nShaping and Baking Croissants:\n\n1. Remove dough from fridge and allow it to rest for 20 minutes or until the butter is pliable again. With the folded side facing you, roll to a 18x11.5-inch rectangle. Use a pizza cutter to trim the edges.\n\n\n\n2. Cut the rectangle into 5 equal rectangles, measuring for accuracy. Cut each rectangle in half on the diagonal to form 10 triangles. \n\n\n\n3. Set a triangle in front of you with the bottom two corners facing you. Brush away loose flour. Gently stretch these corners wider with your fingers and then roll the croissant tight enough that there won't be gaps in the finished pastry. (Update: I now make a small cut in the center of the base of each triangle instead of stretching the edges, then roll.) Lightly press the tip of the triangle into the croissant to help it adhere to the underneath side. Repeat for remaining triangles.\n\n\n\n4. Arrange the croissants on 2 parchment-lined half sheet pans, 5 to each pan. Cover with plastic wrap (not too tightly) and leave at room temperature to proof for several hours (do not exceed 75°F during proofing), or until croissants have doubled in size and wobble like marshmallows when you bump the pan. You should begin to see some separation in the layers when proofing is finished. Meanwhile, preheat your oven to 425°F.\n\n5. Beat your egg and milk together to make an egg wash. Use a pastry brush to brush egg wash over each proofed croissant, avoiding the laminated edges.\n\n6. Bake one pan at a time on the center rack for 15-17 minutes, or until deeply golden brown. (Hold second pan in the fridge until you're ready to egg wash and bake if done proofing.)\n\n7. Place croissants on a cooling rack, and serve or store once they've cooled completely.",
"instructions_list": [
"Feed starter several hours before mixing dough and allow it to peak.",
"Sourdough Croissant Dough:",
Expand Down
1 change: 0 additions & 1 deletion tests/test_data/abuelascounter.com/abuelascounter_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"salt and black pepper",
"2 teaspoons of apple cider vinegar"
],
"instructions": "Preheat the oven to 425 degrees.\nSpread the bottom of your roasting pan with the sliced onions. Season the onions with 2 tablespoons of oil and salt and pepper.\nTime to Prep the Chicken: Remove the chicken giblets. Rinse the chicken inside and out under cold water. Pat the outside dry and put it in a roasting pan.\nWhisk all the ingredients into the olive oil until emulsified.\nSprinkle the chicken with a generous amount of salt and pepper on all sides. Season liberally. You even want to add some salt to the cavity of the chicken. Don’t be afraid.\nAdd the whole onion to the inside of the cavity. You can also add fresh herbs or bay leaves to the cavity.\nPour the marinade over the chicken. Marinate it overnight in the fridge or just for a few minutes.\nRoast the chicken for 30 minutes at 425 degrees then add ¼ cup of water to the bottom of the pan to be sure the onions don’t get too much color and drop the temperature to 350 degrees.\nRoast for another 50-60 minutes. The chicken will roast for a about 90 minutes total.\nThe chicken is ready once the skin is golden brown and the juices run completely clear when you cut with a knife. If you are using a meat thermometer it should read 160 degrees between the breast and thigh area. Once you pull the chicken out of the oven let it rest for 15 minutes then carve and serve.",
"instructions_list": [
"Preheat the oven to 425 degrees.",
"Spread the bottom of your roasting pan with the sliced onions. Season the onions with 2 tablespoons of oil and salt and pepper.",
Expand Down
1 change: 0 additions & 1 deletion tests/test_data/abuelascounter.com/abuelascounter_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"purpose": "For the Filling"
}
],
"instructions": "Preheat the oven to 350 degrees. Line a 9*13 baking pan with parchment paper. You want some of the paper to hang off the sides. Then spray with oil.\nIn a bowl, whisk together the flour, sugar, salt and vanilla bean powder. When it’s all combined, add the softened butter. Press the butter into the flour mixture. The mixture should be crumbly.\nDump the mixture into the baking pan and gently press it down. You can use the bottom of a glass or measuring cup to even everything out.\nBake for 12-15 minutes until it is golden brown. Then set on a rack to cool.\nWhile the crust is cooling make the filling.\nIn a bowl, mix together the eggs, brown sugar, maple syrup, corn starch, butter, vanilla powder, vanilla extract, salt. Beat with an electric mixer until the sugar is completely dissolved into the eggs. It will take a couple minutes.\nAdd the pecans to the mixture. The pecans should be coated completely.\nPour the mixture over the crust. Bake for 25 minutes or until it is completely set. You can stick a toothpick inside to be sure it’s ready.\nRemove from the oven and cool over a wire rack for at least one hour. Once it is cool cut into square or rectangular bars.",
"instructions_list": [
"Preheat the oven to 350 degrees. Line a 9*13 baking pan with parchment paper. You want some of the paper to hang off the sides. Then spray with oil.",
"In a bowl, whisk together the flour, sugar, salt and vanilla bean powder. When it’s all combined, add the softened butter. Press the butter into the flour mixture. The mixture should be crumbly.",
Expand Down
1 change: 0 additions & 1 deletion tests/test_data/acouplecooks.com/acouplecooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"2 lemon wedges",
"Fresh cilantro or parsley, for garnish"
],
"instructions": "If frozen, thaw the shrimp (see the notes above).\nMince the garlic.\nPat the shrimp dry. In a medium bowl, mix the shrimp with the garlic and salt.\nIn a large skillet, heat the butter on medium high heat. Cook the shrimp for 1 to 2 minutes per side until opaque and cooked through, turning them with tongs.\nSpritz with juice of the lemon wedges and serve immediately.",
"instructions_list": [
"If frozen, thaw the shrimp (see the notes above).",
"Mince the garlic.",
Expand Down
1 change: 0 additions & 1 deletion tests/test_data/addapinch.com/addapinch_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"1 cup boiling water",
"Chocolate Buttercream Frosting Recipe"
],
"instructions": "Preheat oven to 350º F. Prepare two 9-inch cake pans by spraying with baking spray or buttering and lightly flouring.\nFor the chocolate cake:\nAdd flour, sugar, cocoa, baking powder, baking soda, salt and espresso powder to a large bowl or the bowl of a stand mixer. Whisk through to combine or, using your paddle attachment, stir through flour mixture until combined well.\nAdd milk, vegetable oil, eggs, and vanilla to flour mixture and mix together on medium speed until well combined. Reduce speed and carefully add boiling water to the cake batter until well combined.\nDistribute cake batter evenly between the two prepared cake pans. Bake for 30-35 minutes, until a toothpick or cake tester inserted in the center of the chocolate cake comes out clean.\nRemove from the oven and allow to cool for about 10 minutes, remove from the pan and cool completely.\nFrost the cake with Chocolate Buttercream Frosting.",
"instructions_list": [
"Preheat oven to 350º F. Prepare two 9-inch cake pans by spraying with baking spray or buttering and lightly flouring.",
"For the chocolate cake:",
Expand Down
1 change: 0 additions & 1 deletion tests/test_data/addapinch.com/addapinch_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"purpose": "Orange Glaze:"
}
],
"instructions": "Prep. Preheat oven to 400º F. Line a rimmed baking sheet pan with parchment paper or a nonstick baking sheet.\nFor the scones:\nMake the Dough. Whisk together flour, sugar, baking powder, and salt in a large bowl. Add butter to the bowl and cut into the flour with a pastry blender until the largest pieces of butter are about the size of a pea and the flour mixture resembles coarse meal. Stir in 3/4 cup of heavy cream, lemon juice, and orange and lemon zests.. Press dough together between the palms of your hands. If it doesn't just hold together, add more heavy cream until is just holds together.\nPrepare the Dough. Pour dough onto a lightly floured countertop or a pastry board. Pat dough into a large round disc, about an inch thick. Cut dough into equal sized wedges and place onto prepared baking sheet pan. Melt about 2 tablespoons butter and brush on top of dough.\nBake. Bake scones for 20-25 minutes or until they are just beginning to turn lightly brown. Remove from the oven.\nOrange Glaze:\nMake the Glaze. Whisk all of the glaze ingredients together in a medium sized bowl until smooth and then drizzle on top of each scone after it has cooled for a few five minutes. Sprinkle with coarse sugar, if desired.",
"instructions_list": [
"Prep. Preheat oven to 400º F. Line a rimmed baking sheet pan with parchment paper or a nonstick baking sheet.",
"For the scones:",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"½ tsp. Salt",
"500 ml. Plain Yogurt"
],
"instructions": "Heat pan over a medium heat and add garlic, ground beef and salt and coriander. Cook until the meat is half-way cooked for about 15 to 20 minutes.\nAdd black pepper and remove from heat.\nCombine one cup of raw chopped onions to the meat and let it cool down to room temperature\nSoak split peas for 2–3 hours or overnight.\nHeat oil in a frying pan and cook onion and garlic until lightly browned.\nAdd tomato and tomato paste. Add split peas and ¾ cup water and cook for 30–45 minutes until soft.\nSeason with salt and pepper and set aside.\nCombine all of the ingredients for dip in a bowl and mix well.\nPlace flour in a large mixing bowl and gradually add water, mixing with hands until it becomes doughy.\nLeave the dough to settle for 15–20 minutes or until it becomes firm.\nSeparate dough into small handfuls and roll into individual ball shapes.\nScatter some flour on the bench surface and using a small rolling pin, roll the balls into circular shapes.\nRoll the dough ball into a very thin (1/16-inch) strips using a pasta machine. Cut the strips into 2-inch squares.\nPlace approximately one tablespoon of the cooled ground beef and onion mixture onto each wrap. To make the wraps stick together easily, wet the edges with water (you may use your fingers or a basting brush).\nFold over first two opposite ends of the egg roll wrap and followed by other two ends to enclose dumplings. Press the edges tightly to seal together. Continue with the remaining wraps.\nTake the racks out of the steamer dish. Add water to the dish, cover and bring to boil.\nOil the base of steamer to prevent sticking and place dumplings carefully across oil.\nCover lid and cook for approximately 40 minutes.\nWhen the dumplings have cooked, add a thin layer of the yogurt mixture to a large serving plate. Place the steamed dumplings on top.\nPour some more of the yogurt mixture on top of the dumplings and coat everything with the the topping sauce.\nGarnish with dried mint and a little bit of cayenne pepper.",
"instructions_list": [
"Heat pan over a medium heat and add garlic, ground beef and salt and coriander. Cook until the meat is half-way cooked for about 15 to 20 minutes.",
"Add black pepper and remove from heat.",
Expand Down
1 change: 0 additions & 1 deletion tests/test_data/aflavorjournal.com/aflavorjournal_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"1/4 tsp. Sea Salt",
"1/4 tsp. freshly cracked Black Pepper"
],
"instructions": "Whisk the 3 tbsp. buttermilk, 2 tbsp. mayonnaise, and 2 tbsp. sour cream together in a medium bowl.\nStir in the dried herbs (1 tsp. dried minced onion, 1 tsp. dried parsley flakes, 1/2 tsp. dried chives, 1/4 tsp. each of onion powder, garlic powder, and dried dill).\nStir in a pinch each of salt and pepper, taste, and add more of either if preferred. For a thinner dressing, stir in more buttermilk (1 tsp. at a time) until the dressing is the consistency you like.\nCover and chill for an hour in the refrigerator for the best flavor, or serve immediately!",
"instructions_list": [
"Whisk the 3 tbsp. buttermilk, 2 tbsp. mayonnaise, and 2 tbsp. sour cream together in a medium bowl.",
"Stir in the dried herbs (1 tsp. dried minced onion, 1 tsp. dried parsley flakes, 1/2 tsp. dried chives, 1/4 tsp. each of onion powder, garlic powder, and dried dill).",
Expand Down
Loading
Loading