Closed jayaddison closed 1 week ago
When I apply these changes to #1307 test case _3 is still expecting 0 servings
. Not sure what's causing it yet
Ah, I think it's that this str(...)
typecast turns a None
value into the string 'None'
.
That input -- and a bunch of other nonsense inputs, seem to return 0 servings
:
>>> from recipe_scrapers._utils import get_yields
>>> get_yields('None')
'0 servings'
>>> get_yields('N one')
'0 servings'
>>> get_yields('N')
'0 servings'
>>> get_yields('n')
'0 servings'
>>> get_yields('adsf')
'0 servings'
I think we can prevent the typecasting of None
to 'None'
-- but I can't think of an easy way to validate other non-empty strings.
Resolves #1313.