Skip to content

Conversation

denisfrm
Copy link

@denisfrm denisfrm commented Jan 8, 2025

This PR fixes the issue that find() is not able to handle None values as written in the issue #153

@michaelmior
Copy link
Collaborator

I would prefer not to remove the bool case that is currently handled, but otherwise this looks good.

@denisfrm
Copy link
Author

denisfrm commented Mar 9, 2025

I would prefer not to remove the bool case that is currently handled, but otherwise this looks good.

Hi @michaelmior , the problem is that the boolean type should not be converted. An example is this unit test:

    pytest.param(
        "foo[?flag = true].color",
        {
            "foo": [
                {"color": "blue", "flag": True},
                {"color": "green", "flag": 2},
                {"color": "red", "flag": "hi"},
                {"color": "gray", "flag": None},
            ]
        },
        ["blue"],
        id="boolean-filter-with-null",
    ),

When you want to search for colors only if flag is equal to true, if we convert the values ​​2, "hi". They will be converted to True. So the result of the test would be ["blue", "green", "red"] instead of ["blue"]

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

Successfully merging this pull request may close these issues.

3 participants