added parse_ingredient test
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -67,6 +67,17 @@ def test_ingredient_regex():
|
|||||||
== "((?:[\\d\\./\\u00BC-\\u00BE\\u2150-\\u215E]*\\s?(?:\\(.+\\))?)*)((?:(?:[cC]up|[oO]unce)e?s?)?)((?:(?:(?:[cC]rushed|[gG]round)(?:ly)?)| )*)([a-zA-Z '\\-]+),?(.*)"
|
== "((?:[\\d\\./\\u00BC-\\u00BE\\u2150-\\u215E]*\\s?(?:\\(.+\\))?)*)((?:(?:[cC]up|[oO]unce)e?s?)?)((?:(?:(?:[cC]rushed|[gG]round)(?:ly)?)| )*)([a-zA-Z '\\-]+),?(.*)"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_parse_ingredient(mock_ingredient):
|
||||||
|
parts = scrape.parse_ingredient(mock_ingredient.text)
|
||||||
|
assert len(parts) > 0
|
||||||
|
assert parts == ['1', 'ounce', '', 'water', None]
|
||||||
|
|
||||||
|
parts = scrape.parse_ingredient("Water")
|
||||||
|
assert len(parts) > 0
|
||||||
|
assert parts == [None, None, None, 'Water', None]
|
||||||
|
|
||||||
|
parts = scrape.parse_ingredient("")
|
||||||
|
assert parts == None
|
||||||
|
|
||||||
def test_parse_recipe_name(mock_site, mock_page, mock_recipe, mock_url, mock_blank_page,):
|
def test_parse_recipe_name(mock_site, mock_page, mock_recipe, mock_url, mock_blank_page,):
|
||||||
expected_name = mock_recipe.name
|
expected_name = mock_recipe.name
|
||||||
|
|||||||
Reference in New Issue
Block a user