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

Fix JSON.ARRINDEX test #2527

Merged
merged 3 commits into from
Dec 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions tests/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -1326,17 +1326,10 @@ def test_arrindex_dollar(client):
[],
]

# Fail with none-scalar value
with pytest.raises(exceptions.ResponseError):
client.json().arrindex("test_None", "$..nested42_empty_arr.arr", {"arr": []})

# Do not fail with none-scalar value in legacy mode
assert (
client.json().arrindex(
"test_None", ".[4][1].nested42_empty_arr.arr", '{"arr":[]}'
)
== -1
)
# Test with none-scalar value
assert client.json().arrindex(
"test_None", "$..nested42_empty_arr.arr", {"arr": []}
) == [-1]

# Test legacy (path begins with dot)
# Test index of int scalar in single value
Expand Down