Improve Test Coverage (#511)

* add recipe scaling notes

* test theme rename

* fix coverage call to use poetry

* remove print

* remove async

* consolidate test case data

* fix mealplan tests

* remove redundant else

Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
Hayden
2021-06-13 13:09:44 -08:00
committed by GitHub
parent c325a49fc2
commit 2dc9c8e843
17 changed files with 249 additions and 230 deletions

View File

@@ -38,14 +38,14 @@ def clean(recipe_data: dict, url=None) -> dict:
def clean_string(text: str) -> str:
if text == "" or text is None:
return ""
else:
cleaned_text = html.unescape(text)
cleaned_text = re.sub("<[^<]+?>", "", cleaned_text)
cleaned_text = re.sub(" +", " ", cleaned_text)
cleaned_text = re.sub("</p>", "\n", cleaned_text)
cleaned_text = re.sub(r"\n\s*\n", "\n\n", cleaned_text)
cleaned_text = cleaned_text.replace("\xa0", " ").replace("\t", " ").strip()
return cleaned_text
cleaned_text = html.unescape(text)
cleaned_text = re.sub("<[^<]+?>", "", cleaned_text)
cleaned_text = re.sub(" +", " ", cleaned_text)
cleaned_text = re.sub("</p>", "\n", cleaned_text)
cleaned_text = re.sub(r"\n\s*\n", "\n\n", cleaned_text)
cleaned_text = cleaned_text.replace("\xa0", " ").replace("\t", " ").strip()
return cleaned_text
def category(category: str):
@@ -82,6 +82,10 @@ def instructions(instructions) -> List[dict]:
if not instructions:
return []
# Dictionary (Keys: step number strings, Values: the instructions)
if isinstance(instructions, dict):
instructions = list(instructions.values())
if isinstance(instructions, list) and isinstance(instructions[0], list):
instructions = instructions[0]