[Type verification] What is the expectation if user's API call sent wrong type? Such as `adult = "A String False"`.
- Dominant language
- Python
- Stars
- 48
- Forks
- 27
- PR merge metrics
- No merged PRs in 30d
Description
For example, if in here, user sent API call that `adult = "A String False"`
https://github.com/google/shoptimizer/blob/a9fff3ac203e39480dff7585fa37b999fbe7470e/shoptimizer_api/optimizers_builtin/adult_optimizer.py#L89
Then in here the UT will fail, as shoptimizer will send string "False" directly outside.
https://github.com/google/shoptimizer/blob/a9fff3ac203e39480dff7585fa37b999fbe7470e/shoptimizer_api/optimizers_builtin/adult_optimizer_test.py#L273
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
https://github.com/google/shoptimizer/blob/a9fff3ac203e39480dff7585fa37b999fbe7470e/shoptimizer_api/optimizers_builtin/adult_optimizer.py#L92
2. Passed
https://github.com/google/shoptimizer/blob/a9fff3ac203e39480dff7585fa37b999fbe7470e/shoptimizer_api/optimizers_builtin/adult_optimizer.py#L101
Then shoptimizer don't think its adult field need to change or santinize.
Just ask, is this phenomenon within the expectation?
Contributor guide
Assessment
This issue has not been assessed yet.