Skip to content

Conversation

mjohanse-emr
Copy link
Contributor

@mjohanse-emr mjohanse-emr commented Sep 3, 2025

What does this Pull Request accomplish?

  • Add converter classes for bintime.TimeDelta and hightime.timedelta.
    • Both of these python types convert to the protobuf PrecisionDuration
    • Converting a PrecisionDuration to python results in a hightime.timedelta (we have to choose one)
  • Add unit tests for the new converters
  • Add hightime.timedelta and bintime.TimeDelta to the all-types example
  • Change the conversion behavior so that PrecisionTimestamp converts to hightime.datetime based on a recent decision to use hightime for drivers.

Why should this Pull Request be merged?

Implements part of AB#3069081

What testing has been done?

All types example, unit tests, mypy, pyright, styleguide.

Signed-off-by: Michael Johansen <michael.johansen@ni.com>
Copy link
Contributor

github-actions bot commented Sep 3, 2025

Test Results

   10 files  ± 0     10 suites  ±0   23s ⏱️ -4s
  256 tests + 5    256 ✅ + 5  0 💤 ±0  0 ❌ ±0 
2 510 runs  +50  2 510 ✅ +50  0 💤 ±0  0 ❌ ±0 

Results for commit df6558b. ± Comparison against base commit 87fe083.

This pull request removes 37 and adds 42 tests. Note that renamed tests count towards both.
tests.unit.test_convert ‑ test___precision_timestamp_proto__from_any___valid_bintime_datetime
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object13-hightime.datetime]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object14-collections.abc.Collection[builtins.bool]]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object15-collections.abc.Collection[builtins.bytes]]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object16-collections.abc.Collection[builtins.float]]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object17-collections.abc.Collection[builtins.int]]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object18-collections.abc.Collection[builtins.str]]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object19-collections.abc.Collection[builtins.bool]]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object20-collections.abc.Collection[builtins.bytes]]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object21-collections.abc.Collection[builtins.float]]
…
tests.unit.test_convert ‑ test___precision_duration_proto__from_any___valid_hightime_timedelta
tests.unit.test_convert ‑ test___precision_timestamp_proto__from_any___valid_hightime_datetime
tests.unit.test_convert ‑ test___python_bintime_timedelta__to_any___valid_precision_duration_proto
tests.unit.test_convert ‑ test___python_hightime_timedelta__to_any___valid_precision_duration_proto
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object13-nitypes.bintime.TimeDelta]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object14-hightime.datetime]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object15-hightime.timedelta]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object16-collections.abc.Collection[builtins.bool]]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object17-collections.abc.Collection[builtins.bytes]]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object18-collections.abc.Collection[builtins.float]]
…

♻️ This comment has been updated with latest results.

Signed-off-by: Michael Johansen <michael.johansen@ni.com>
@mjohanse-emr mjohanse-emr merged commit 6b261b5 into main Sep 4, 2025
14 checks passed
@mjohanse-emr mjohanse-emr deleted the users/mjohanse/timedelta_converters branch September 4, 2025 15:17
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.

2 participants