-
Notifications
You must be signed in to change notification settings - Fork 0
Add unit tests for _convert.to_any() and _convert.from_any() #86
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
Conversation
Signed-off-by: Michael Johansen <michael.johansen@ni.com>
Signed-off-by: Michael Johansen <michael.johansen@ni.com>
Signed-off-by: Michael Johansen <michael.johansen@ni.com>
Signed-off-by: Michael Johansen <michael.johansen@ni.com>
| @@ -0,0 +1,131 @@ | |||
| from typing import Any, Type, Union | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typing.Type is no longer needed in Python 3.9+, use type[T] instead.
| # ======================================================== | ||
| # Pack/Unpack Helpers | ||
| # ======================================================== | ||
| def _assert_any_and_unpack(packed_message: any_pb2.Any, unpack_destination: Any) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, a more precise type for unpack_destination would be Message (i.e. google.protobuf.message.Message).
What does this Pull Request accomplish?
Adds unit tests for
_convert.to_any()and_convert.from_any()Why should this Pull Request be merged?
Since we are going to be adding more protobuf types (Scalar, Analog Waveform, etc.) to this _convert file soon, having unit tests is a good way to try and prevent breakages for existing functionality.
What testing has been done?
pytest, mypy, styleguide