Skip to content

Conversation

@mjohanse-emr
Copy link
Contributor

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

Michael Johansen added 3 commits June 17, 2025 12:52
@github-actions
Copy link
Contributor

github-actions bot commented Jun 19, 2025

Test Results

   10 files  ±  0     10 suites  ±0   16s ⏱️ -1s
  116 tests + 20    116 ✅ + 20  0 💤 ±0  0 ❌ ±0 
1 130 runs  +200  1 130 ✅ +200  0 💤 ±0  0 ❌ ±0 

Results for commit 4ffcd2c. ± Comparison against base commit 1857f57.

♻️ This comment has been updated with latest results.

Signed-off-by: Michael Johansen <[email protected]>
@mjohanse-emr mjohanse-emr merged commit 4752bbc into main Jun 19, 2025
14 checks passed
@mjohanse-emr mjohanse-emr deleted the users/mjohanse/convert_unit_tests branch June 19, 2025 15:33
@@ -0,0 +1,131 @@
from typing import Any, Type, Union
Copy link
Collaborator

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:
Copy link
Collaborator

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).

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.

5 participants