-
Notifications
You must be signed in to change notification settings - Fork 201
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 algorithm for parsing smart filters #1276
Conversation
- `and` is now considered the default operation instead of raising error - fix algorithm so that the reserved keys are parsed in the filters dictionary instead of filters group when located later in the feed. - removed some code repetition
If multiple filter groups are parsed they are joined by `and` instead of raising error.
transfers "=" from the value to key
Thanks. Could you add some tests with some more complex filters? Right now the tests only check that searching with the parsed filters returns the same items. python-plexapi/tests/test_collection.py Lines 278 to 279 in e44939c
python-plexapi/tests/test_playlist.py Lines 198 to 200 in e44939c
The new tests should actually check that the filter and parsed filter dictionaries are equal. parsedFilters = collection.filters()
assert filters == parsedFilters parsedFilters = playlist.filters()
assert filters == parsedFilters |
Could you please guide me to a document where I can learn how to setup plex environment for testing? Currently running test locally fails all of them except a few. I have to use GH Actions every time, and it would be great to have it run locally. I know it sets up pms using docker but if there was a script for this to do automatically? |
See Discord. |
this test would fail on old algorithm despite it being logically the exact same filter.
I have added 2 tests which will fail for the old algorithm that are passing for this PR. |
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.
The logic looks good. Thanks!
Just a few stylistic changes.
adhere to style guide of the project Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
Description
algorithm for parsing is updated to cover multilevel filter groups parsing
Fixes
SmartFilterMixin._parseFilters
algorithm fails when multi-level filters are to be parsed #1274Type of change
Checklist: