Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Type verification] What is the expectation if user's API call sent wrong type? Such as adult = "A String False". #20

Open
Solodye opened this issue Jun 17, 2024 · 0 comments

Comments

@Solodye
Copy link

Solodye commented Jun 17, 2024

For example, if in here, user sent API call that adult = "A String False"

is_adult = product.get('adult', False)

Then in here the UT will fail, as shoptimizer will send string "False" directly outside.

def test_adult_optimizer_does_nothing_if_adult_tokens_in_description_but_category_is_not_adult(

Because in Python3, if not "any string" its value will be False in boolean. Then this will cause all these two if being passed

  1. Passed
    if not is_adult and self._is_product_type_adult(product_types):
  2. Passed
    elif not is_adult and category_specific_tokens:

Then shoptimizer don't think its adult field need to change or santinize.

Just ask, is this phenomenon within the expectation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant