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

Cleanup: remove test_settings_module #663

Merged
merged 3 commits into from Oct 21, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions recipe_scrapers/_schemaorg.py
Expand Up @@ -126,6 +126,8 @@ def prep_time(self):
return get_minutes(self.data.get("prepTime"), return_zero_on_not_found=True)

def yields(self):
if not (self.data.keys() & {"recipeYield", "yield"}):
raise SchemaOrgException("Servings information not found in SchemaOrg")
yield_data = self.data.get("recipeYield") or self.data.get("yield")
if yield_data and isinstance(yield_data, list):
yield_data = yield_data[0]
Expand Down
6 changes: 0 additions & 6 deletions recipe_scrapers/davidlebovitz.py
Expand Up @@ -13,12 +13,6 @@ def author(self):
def title(self):
return self.schema.title()

def total_time(self):
return self.schema.total_time()

def yields(self):
return self.schema.yields()

def image(self):
return self.schema.image()

Expand Down
3 changes: 0 additions & 3 deletions recipe_scrapers/franzoesischkochen.py
Expand Up @@ -30,6 +30,3 @@ def ingredients(self):

def instructions(self):
return self.schema.instructions()

def ratings(self):
return self.schema.ratings()
3 changes: 0 additions & 3 deletions recipe_scrapers/mobkitchen.py
Expand Up @@ -54,9 +54,6 @@ def ingredients(self):
def instructions(self):
return self.schema.instructions()

def ratings(self):
return self.schema.ratings()

def cuisine(self):
return self.schema.cuisine()

Expand Down
3 changes: 0 additions & 3 deletions recipe_scrapers/myrecipes.py
Expand Up @@ -24,6 +24,3 @@ def ingredients(self):

def instructions(self):
return self.schema.instructions()

def ratings(self):
return self.schema.ratings()
3 changes: 0 additions & 3 deletions recipe_scrapers/southernliving.py
Expand Up @@ -43,9 +43,6 @@ def instructions(self):
]
)

def ratings(self):
return self.schema.ratings()

def description(self):
des = self.soup.find(
"div",
Expand Down
3 changes: 0 additions & 3 deletions recipe_scrapers/springlane.py
Expand Up @@ -42,6 +42,3 @@ def ingredients(self):

def instructions(self):
return self.schema.instructions()

def ratings(self):
return self.schema.ratings()
3 changes: 0 additions & 3 deletions recipe_scrapers/woolworths.py
Expand Up @@ -68,9 +68,6 @@ def ingredients(self):
def instructions(self):
return self.schema.instructions()

def ratings(self):
return self.schema.ratings()

def author(self):
return self.schema.author()

Expand Down
5 changes: 0 additions & 5 deletions tests/__init__.py
@@ -1,4 +1,3 @@
import os
import unittest
from typing import Any, Iterator, Optional, Tuple

Expand All @@ -23,10 +22,6 @@ def expected_requests(self) -> Iterator[Tuple[str, str, str]]:
yield responses.GET, "https://test.example.com", path

def setUp(self):
os.environ[
"RECIPE_SCRAPERS_SETTINGS"
] = "tests.test_data.test_settings_module.test_settings"

with responses.RequestsMock() as rsps:
start_url = None
for method, url, path in self.expected_requests:
Expand Down
35 changes: 0 additions & 35 deletions tests/test__settings_module.py

This file was deleted.

10 changes: 1 addition & 9 deletions tests/test_cookstr.py
@@ -1,5 +1,3 @@
import os

from recipe_scrapers.cookstr import Cookstr
from tests import ScraperTest

Expand All @@ -23,14 +21,8 @@ def test_title(self):
def test_total_time(self):
self.assertEqual(60, self.harvester_class.total_time())

def test_total_yields(self):
self.assertEqual(None, self.harvester_class.yields())

def test_total_yields_raises_exception(self):
os.environ["RECIPE_SCRAPERS_SETTINGS"] = "recipe_scrapers.settings.default"

with self.assertRaises(Exception):
self.assertEqual(None, self.harvester_class.yields())
self.assertRaises(Exception, self.harvester_class.yields)

def test_ingredients(self):
self.assertCountEqual(
Expand Down
Empty file.
2 changes: 0 additions & 2 deletions tests/test_data/test_settings_module/test_settings.py

This file was deleted.

6 changes: 0 additions & 6 deletions tests/test_davidlebovitz.py
Expand Up @@ -15,12 +15,6 @@ def test_author(self):
def test_title(self):
self.assertEqual("Faux Gras", self.harvester_class.title())

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

def test_yields(self):
self.assertEqual("0 servings", self.harvester_class.yields())

def test_image(self):
self.assertEqual(
"https://www.davidlebovitz.com/wp-content/uploads/2015/06/Faux-Gras-Lentil-Pate-8.jpg",
Expand Down
3 changes: 0 additions & 3 deletions tests/test_epicurious.py
Expand Up @@ -21,9 +21,6 @@ def test_title(self):
"Ramen Noodle Bowl with Escarole and Spicy Tofu Crumbles",
)

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

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

Expand Down
3 changes: 0 additions & 3 deletions tests/test_franzoesischkochen.py
Expand Up @@ -65,6 +65,3 @@ def test_instructions(self):
),
self.harvester_class.instructions(),
)

def test_ratings(self):
self.assertEqual(None, self.harvester_class.ratings())
3 changes: 0 additions & 3 deletions tests/test_kwestiasmaku.py
Expand Up @@ -15,9 +15,6 @@ def test_author(self):
def test_title(self):
self.assertEqual("Pieczony kalafior", self.harvester_class.title())

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

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

Expand Down
3 changes: 0 additions & 3 deletions tests/test_mobkitchen.py
Expand Up @@ -59,9 +59,6 @@ def test_instructions(self):
self.harvester_class.instructions(),
)

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

def test_cuisine(self):
self.assertEqual("Indian", self.harvester_class.cuisine())

Expand Down
10 changes: 1 addition & 9 deletions tests/test_myrecipes.py
@@ -1,6 +1,3 @@
import os

from recipe_scrapers._exceptions import SchemaOrgException
from recipe_scrapers.myrecipes import MyRecipes
from tests import ScraperTest

Expand Down Expand Up @@ -51,13 +48,8 @@ def test_instructions(self):
self.harvester_class.instructions(),
)

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

def test_ratings_raises_exception(self):
os.environ["RECIPE_SCRAPERS_SETTINGS"] = "recipe_scrapers.settings.default"
with self.assertRaises(SchemaOrgException):
self.assertEqual(None, self.harvester_class.ratings())
self.assertRaises(Exception, self.harvester_class.ratings)


# https://www.myrecipes.com/recipe/cacio-e-pepe
10 changes: 1 addition & 9 deletions tests/test_southernliving.py
@@ -1,6 +1,3 @@
import os

from recipe_scrapers._exceptions import SchemaOrgException
from recipe_scrapers.southernliving import SouthernLiving
from tests import ScraperTest

Expand Down Expand Up @@ -67,13 +64,8 @@ def test_instructions(self):
self.harvester_class.instructions(),
)

def test_ratings_exception_handling(self):
self.assertEqual(None, self.harvester_class.ratings())

def test_ratings_raises_exception(self):
os.environ["RECIPE_SCRAPERS_SETTINGS"] = "recipe_scrapers.settings.default"
with self.assertRaises(SchemaOrgException):
self.assertEqual(None, self.harvester_class.ratings())
self.assertRaises(Exception, self.harvester_class.ratings)

def test_description(self):
self.assertEqual(
Expand Down
3 changes: 0 additions & 3 deletions tests/test_springlane.py
Expand Up @@ -75,6 +75,3 @@ def test_instructions(self):
+ "Restliche L\u00f6ffelbiskuits, Espresso und Creme daraufgeben, mindestens 4 Stunden kaltstellen. Vor dem Servieren mit Kakaopulver best\u00e4uben.",
self.harvester_class.instructions(),
)

def test_ratings(self):
self.assertEqual(None, self.harvester_class.ratings())
3 changes: 0 additions & 3 deletions tests/test_woolworths.py
Expand Up @@ -82,9 +82,6 @@ def test_nutrients(self):
def test_language(self):
self.assertEqual("en-AU", self.harvester_class.language())

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

def test_site_name(self):
self.assertEqual(
"Woolworths | Fresh Ideas For You", self.harvester_class.site_name()
Expand Down