Skip to content

Commit

Permalink
mob.co.uk: update test data and apply a few fixes/cleanups (#1198)
Browse files Browse the repository at this point in the history
  • Loading branch information
jknndy authored Jul 31, 2024
1 parent 20bad7e commit cc45b63
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 27 deletions.
6 changes: 1 addition & 5 deletions recipe_scrapers/mob.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json

from ._abstract import AbstractScraper
from ._exceptions import StaticValueException
from ._grouping_utils import IngredientGroup


Expand All @@ -17,9 +16,6 @@ def __init__(self, *args, **kwargs):
def host(cls):
return "mob.co.uk"

def site_name(self):
raise StaticValueException(return_value="Mob")

def author(self):
chefs = self.recipe_json.get("chefs", [])
return " & ".join([chef["title"] for chef in chefs]) if chefs else "Mob Team"
Expand Down Expand Up @@ -88,4 +84,4 @@ def description(self):
return self.recipe_json.get("summary", "")

def ratings(self):
return self.recipe_json.get("averageRating", "")
return round(float(self.recipe_json.get("averageRating", "0")), 2)
17 changes: 3 additions & 14 deletions tests/test_data/mob.co.uk/mob_1.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"author": "Mob Team",
"author": "Seema Pankhania",
"canonical_url": "https://www.mob.co.uk/recipes/chilli-cheese-paratha",
"site_name": "Mob",
"host": "mob.co.uk",
Expand Down Expand Up @@ -54,17 +54,6 @@
"description": "This Indian snack is oozing with molten cheese and chilli garlicky goodness. They will be demolished in seconds, I can promise you that. Seema x",
"total_time": 30,
"cuisine": "Indian",
"ratings": "4.647",
"nutrients": {
"servingSize": "4"
},
"image": "https://files.mob-cdn.co.uk/recipes/9K8A6392-2.jpg",
"keywords": [
"chilli cheese paratha",
"indian cheese paratha",
"indian paratha recipe",
"cheese paratha recipe",
"chilli cheese paratha recipe",
"cheesy paratha recipe"
]
"ratings": 4.65,
"image": "https://files.mob-cdn.co.uk/recipes/2023/11/Chilli-Cheese-Paratha.jpg"
}
7 changes: 4 additions & 3 deletions tests/test_data/mob.co.uk/mob_1.testhtml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/test_data/mob.co.uk/mob_2.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"author": "Christina Soteriou",
"canonical_url": "mob.co.uk",
"canonical_url": "https://www.mob.co.uk/recipes/speedy-udon-miso-noodle-soup",
"site_name": "Mob",
"host": "mob.co.uk",
"language": "en",
Expand Down Expand Up @@ -34,6 +34,6 @@
"description": "This noodle soup is a testament to a well-stocked cupboard. All you need is a handful of long life staples to throw this nutritious and delicious meal together.",
"total_time": 15,
"cuisine": "Asian-Inspired",
"ratings": "4.125",
"ratings": 4.47,
"image": "https://files.mob-cdn.co.uk/recipes/2023/09/Speedy-Udon-Miso-Noodle-Soup.jpg"
}
6 changes: 3 additions & 3 deletions tests/test_data/mob.co.uk/mob_2.testhtml

Large diffs are not rendered by default.

0 comments on commit cc45b63

Please sign in to comment.