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

Non-components should raise an error when being configured #130

Closed
timdebruin opened this issue Mar 16, 2020 · 0 comments
Closed

Non-components should raise an error when being configured #130

timdebruin opened this issue Mar 16, 2020 · 0 comments
Assignees

Comments

@timdebruin
Copy link
Contributor

timdebruin commented Mar 16, 2020

Describe the bug

A subclass of a component that itself does not have an @component decorator can be initialized with configure without any errors. It will then not act as expected, since it is not a component.

To Reproduce

@component
class BaseComponent:
    value: int = Field(1)

class SubclassedComponent(BaseComponent):
    value = Field(2)
    
component = SubclassedComponent()
configure(component, {})
print(component.value)  # prints 1
assert component.value == 2  # fails

Expected behavior

During the call to configure an error should be thrown that the component being configured is not a component.

Environment

Zookeeper version: 1.0b7

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

No branches or pull requests

2 participants