added test for creating regex
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:
@@ -9,4 +9,17 @@ def test_load_page():
|
||||
assert type(page) == BeautifulSoup
|
||||
|
||||
page = scrape.load_page("https://hs.andreistoica.ca:4943/some-nonesense")
|
||||
assert page == None
|
||||
assert page == None
|
||||
|
||||
|
||||
def test_ingredient_regex():
|
||||
regex = scrape.ingredient_regex(["cup"], ["crushed"])
|
||||
assert (
|
||||
regex.pattern
|
||||
== "((?:[\\d\\./\\u00BC-\\u00BE\\u2150-\\u215E]*\\s?(?:\\(.+\\))?)*)((?:(?:[cC]up)e?s?)?)((?:(?:(?:[cC]rushed)(?:ly)?)| )*)([a-zA-Z '\\-]+),?(.*)"
|
||||
)
|
||||
regex = scrape.ingredient_regex(["cup", "ounce"], ["crushed", "ground"])
|
||||
assert (
|
||||
regex.pattern
|
||||
== "((?:[\\d\\./\\u00BC-\\u00BE\\u2150-\\u215E]*\\s?(?:\\(.+\\))?)*)((?:(?:[cC]up|[oO]unce)e?s?)?)((?:(?:(?:[cC]rushed|[gG]round)(?:ly)?)| )*)([a-zA-Z '\\-]+),?(.*)"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user