Skip to content

Conversation

@mjohanse-emr
Copy link
Contributor

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

What does this Pull Request accomplish?

  • Adds a converter between datetime.timedelta and duration_pb2.Duration.
  • Adds unit tests for this converter.
  • Adds a datetime.timedelta value to the "all types" example.
    • Shows up as an indicator only. There wasn't a suitable control to use unless we input hours/minutes/seconds separately. I don't think it's a common use case to want to input a timedelta on the panel, so I think this is sufficient.

Why should this Pull Request be merged?

Implements part of AB#3164818

What testing has been done?

Unit tests, mypy, pyright, styleguide.

I ran the "all types" example and this is what shows up for dt_datetime:
image

Signed-off-by: Michael Johansen <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2025

Test Results

   10 files  ± 0     10 suites  ±0   23s ⏱️ -8s
  227 tests + 3    227 ✅ + 3  0 💤 ±0  0 ❌ ±0 
2 220 runs  +30  2 220 ✅ +30  0 💤 ±0  0 ❌ ±0 

Results for commit 29ab5ea. ± Comparison against base commit 5ade5a6.

This pull request removes 26 and adds 29 tests. Note that renamed tests count towards both.
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object11-Collection.bool]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object12-Collection.bytes]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object13-Collection.float]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object14-Collection.int]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object15-Collection.str]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object16-Collection.bool]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object17-Collection.bytes]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object18-Collection.float]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object19-Collection.int]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object20-Collection.str]
…
tests.unit.test_convert ‑ test___durationpb2_timestamp___from_any___valid_python_value
tests.unit.test_convert ‑ test___python_datetime_timedelta___to_any___valid_durationpb2_value
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object11-timedelta]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object12-Collection.bool]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object13-Collection.bytes]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object14-Collection.float]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object15-Collection.int]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object16-Collection.str]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object17-Collection.bool]
tests.unit.test_convert ‑ test___various_python_objects___get_best_matching_type___returns_correct_type_string[python_object18-Collection.bytes]
…

♻️ This comment has been updated with latest results.

@mjohanse-emr mjohanse-emr merged commit b5f258f into main Aug 4, 2025
14 checks passed
@mjohanse-emr mjohanse-emr deleted the users/mjohanse/timedelta_conv branch August 4, 2025 18:07
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.

4 participants