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 watchers support when the Parameterized instance is falsey #769

Merged
merged 4 commits into from Jun 22, 2023

Conversation

maximlt
Copy link
Member

@maximlt maximlt commented Jun 21, 2023

Fixes #747

inst or cls was used to select cls when inst was None, except that this fails when inst is not None and inst is falsey evaluates, as in the example reported in the issue where __len__ is defined on a Parameterized class and returns 0. This PR fixes a few occurrences of this bug.

@maximlt maximlt requested a review from philippjfr June 22, 2023 13:13
Copy link
Member

@philippjfr philippjfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

param/parameterized.py Outdated Show resolved Hide resolved
param/parameterized.py Outdated Show resolved Hide resolved
param/parameterized.py Outdated Show resolved Hide resolved
param/parameterized.py Outdated Show resolved Hide resolved
@philippjfr
Copy link
Member

Minor, nitpicky comments.

@maximlt maximlt merged commit 4700b7c into main Jun 22, 2023
10 checks passed
@maximlt maximlt deleted the fix_instance_truth_check branch June 22, 2023 14:53
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.

watcher doesn't work with __len__
3 participants