mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-02 22:13:11 -05:00
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:
@@ -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]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user