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 ServiceState constructors for 0 Enum #37

Merged
merged 1 commit into from
Nov 22, 2022
Merged

Conversation

Hackerman342
Copy link
Collaborator

No description provided.

@ethanrublee ethanrublee merged commit f292d6f into main Nov 22, 2022
@Hackerman342 Hackerman342 deleted the fix-state-bug branch November 22, 2022 23:08
@@ -28,7 +28,9 @@ class CanbusServiceState:
"""Canbus service state."""

def __init__(self, proto: canbus_pb2.CanbusServiceState = None) -> None:
self._proto = proto or canbus_pb2.CanbusServiceState.UNAVAILABLE
self._proto = canbus_pb2.CanbusServiceState.UNAVAILABLE
Copy link
Member

Choose a reason for hiding this comment

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

self._proto = proto or canbus_pb2.CanbusServiceState.UNAVAILABLE

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@edgarriba That was causing a bug. If the proto is the 0 item in the FooServiceState Enum, it evaluates to False and is set to UNAVAILABLE instead of the passed proto

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.

3 participants