-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
update json().arrindex() default values #2611
Conversation
Codecov ReportPatch coverage:
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## master #2611 +/- ##
==========================================
- Coverage 92.31% 92.25% -0.07%
==========================================
Files 115 115
Lines 29744 29760 +16
==========================================
- Hits 27459 27455 -4
- Misses 2285 2305 +20
... and 5 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
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.
Thanks for the fix!
Fixed the bool checks - forgot that 0 is falsey. Added a few more unit tests. |
@davemcphee Great, thank you! Can you add the tests also to the async test (in test_asyncio/test_json.py)? |
* update json().arrindex() default values * add unit test * fix falsy checks * more unit tests * add asyncio tests * fix lint line length --------- Co-authored-by: Alex Schmitz <aschmitz@box.com>
* Fixed issue #2598 - make Document class subscriptable * Last time added older file, fixed it * retrigger checks * update json().arrindex() default values (#2611) * update json().arrindex() default values * add unit test * fix falsy checks * more unit tests * add asyncio tests * fix lint line length --------- Co-authored-by: Alex Schmitz <aschmitz@box.com> * Speeding up the protocol parsing (#2596) * speeding up the protocol parser * linting * changes to ease * Fixed CredentialsProvider examples (#2587) Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com> * ConnectionPool SSL example (#2605) * [types] update return type of smismember to list[int] (#2617) * update return type of smismember * use Literal instead of int * retrigger checks * Added test for document subscriptable in tests/test_search.py * Fixed linter issue * retrigger checks --------- Co-authored-by: Alex Schmitz <alex.schmitz@gmail.com> Co-authored-by: Alex Schmitz <aschmitz@box.com> Co-authored-by: Chayim <chayim@users.noreply.github.com> Co-authored-by: Bar Shaul <88437685+barshaul@users.noreply.github.com> Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com> Co-authored-by: CrimsonGlory <CrimsonGlory@users.noreply.github.com> Co-authored-by: Raymond Yin <raymond@tryevergreen.com>
Pull Request check-list
Please make sure to review and check all of these items:
$ tox
pass with this change (including linting)?NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
Description of change
Refactor default
start
/stop
values in thejson().arrindex()
function. Previously, ifstop
was unset, the stop value would default to -1. If the value being searched was the last element in an array, andstop
was set to -1, the server would reply with -1 instead of the element's index.eg.: given a json object myarr:
{"l": ["a", "b", "c", "d"]}
:By only appending
start
andstop
values to theJSON.ARRINDEX
command if they're set, the python client more closely mimics redis' behaviour.Fixes #2481