-
Notifications
You must be signed in to change notification settings - Fork 32
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
Separate coil configuration from data #83
Comments
I was initially thinking about it. But decided to have value inside coil. What is wrong with testing? |
doing stuff like write_coil.assert_called_with() is hard, since you need to be able to provide a new instance of a Coil object with same parameters as the original Coil object in the data base, but with the expected value. If you naively grab the Coil from the coil db, and update it's value to the expected value, you break the instance that is you are checking against. |
I was thinking how to approach that. Decided to create such a class. @dataclass
class CoilData:
coil: Coil
value: Union[int, float, str, None] = None
# def is_valid:
# ... etc ... Then all |
Right now the coil object database ends up being state-full, with the value being stored in the object loaded by the json database. This make things somewhat tricky to test and can have odd behaviours with the coil value changing behind ones back.
The coil value should not be stored in the Coil object.
The text was updated successfully, but these errors were encountered: