-
Notifications
You must be signed in to change notification settings - Fork 232
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
Add support for parsing boolean values in from_json
#9620
Conversation
…em being dropped if incomplete or invalid
from_json
from_json
build |
@pytest.mark.parametrize('pattern', [ | ||
r'{ "bool": [truefalsTRUEFALS]{1,5} }', | ||
r'{ "bool": "[truefalsTRUEFALS]{1,5}" }', | ||
pytest.param(r'{ "bool": [0-9]{0,2}(\.[0-9]{1,2})? }', marks=pytest.mark.xfail(reason='TBD')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need an actual issue for this, not just TBD
.with_special_pattern('null', weight=50) | ||
@pytest.mark.parametrize('pattern', [ | ||
r'{ "bool": [truefalsTRUEFALS]{1,5} }', | ||
r'{ "bool": "[truefalsTRUEFALS]{1,5}" }', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what is the probability that this actually shows up as "true" or "false"? I think it has to be worse than 1 out of 524288 rows 2/(16^5)
because that would be the probability for {5}
at the end, but it is {1,5}
. Those values should be returned as null
because a quoted string should not be interpreted as a boolean, but I don't think this code is doing that. I could be wrong though, but the probabilities don't give me a lot of comfort that we have covered that test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the tests and added a link to the issue
build |
Closes #9597
Changes in this PR:
from_json