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

Get default for backend var defined in mixin #4060

Merged
merged 2 commits into from
Oct 7, 2024

Conversation

masenf
Copy link
Collaborator

@masenf masenf commented Oct 4, 2024

If the backend var is defined in a mixin class, it won't appear in cls.__dict__, but the value is still retrievable via getattr on cls. Prefer to use the actual defined default before using Var.get_default_value().

If Var.get_default_value() fails, set the default to None such that the backend var still gets recognized as a backend var when it is used on self.


Update test_component_state to include backend vars

Extra coverage for backend vars with and without defaults, defined in a ComponentState/mixin class.

masenf added 2 commits October 4, 2024 11:38
If the backend var is defined in a mixin class, it won't appear in
`cls.__dict__`, but the value is still retrievable via `getattr` on `cls`.
Prefer to use the actual defined default before using
`Var.get_default_value()`.

If `Var.get_default_value()` fails, set the default to `None` such that the
backend var still gets recognized as a backend var when it is used on `self`.

----

Update test_component_state to include backend vars

Extra coverage for backend vars with and without defaults, defined in a
ComponentState/mixin class.
@masenf masenf merged commit 5c05180 into main Oct 7, 2024
39 checks passed
@masenf masenf deleted the masenf/backend-var-default2 branch October 7, 2024 16:33
masenf added a commit that referenced this pull request Oct 7, 2024
* Get default for backend var defined in mixin

If the backend var is defined in a mixin class, it won't appear in
`cls.__dict__`, but the value is still retrievable via `getattr` on `cls`.
Prefer to use the actual defined default before using
`Var.get_default_value()`.

If `Var.get_default_value()` fails, set the default to `None` such that the
backend var still gets recognized as a backend var when it is used on `self`.

----

Update test_component_state to include backend vars

Extra coverage for backend vars with and without defaults, defined in a
ComponentState/mixin class.

* fix integration test
Kastier1 pushed a commit that referenced this pull request Oct 23, 2024
* Get default for backend var defined in mixin

If the backend var is defined in a mixin class, it won't appear in
`cls.__dict__`, but the value is still retrievable via `getattr` on `cls`.
Prefer to use the actual defined default before using
`Var.get_default_value()`.

If `Var.get_default_value()` fails, set the default to `None` such that the
backend var still gets recognized as a backend var when it is used on `self`.

----

Update test_component_state to include backend vars

Extra coverage for backend vars with and without defaults, defined in a
ComponentState/mixin class.

* fix integration test
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.

2 participants