chore: postpone annotations and add validation refinements#2357
Merged
Conversation
Add postponed annotations to test modules and modernize one test helper annotation for Python 3.9-compatible collection. Co-authored-by: Codex <codex@openai.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #2357 +/- ##
=======================================
Coverage 82% 82%
=======================================
Files 68 68
Lines 9523 9560 +37
=======================================
+ Hits 7823 7881 +58
+ Misses 1700 1679 -21 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR modernizes the test suite by enabling postponed evaluation of type annotations (from __future__ import annotations) across test modules, aligning test typing behavior with newer Python typing patterns while keeping runtime behavior unchanged in tests.
Changes:
- Added
from __future__ import annotationsat the top of the test modules touched to postpone annotation evaluation. - Updated
_yolo_dataset_factory’sclassesparameter annotation intests/metrics/conftest.pyfromOptional[list[str]]tolist[str] | None.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/utils/test_video.py | Adds postponed-annotations future import. |
| tests/utils/test_iterables.py | Adds postponed-annotations future import. |
| tests/utils/test_internal.py | Adds postponed-annotations future import. |
| tests/utils/test_image.py | Adds postponed-annotations future import. |
| tests/utils/test_conversion.py | Adds postponed-annotations future import. |
| tests/utils/conftest.py | Adds postponed-annotations future import. |
| tests/tracker/test_byte_tracker.py | Adds postponed-annotations future import. |
| tests/metrics/test_recall.py | Adds postponed-annotations future import. |
| tests/metrics/test_precision.py | Adds postponed-annotations future import. |
| tests/metrics/test_oriented_bounding_box_metrics.py | Adds postponed-annotations future import. |
| tests/metrics/test_mean_average_recall.py | Adds postponed-annotations future import. |
| tests/metrics/test_mean_average_precision.py | Adds postponed-annotations future import. |
| tests/metrics/test_f1_score.py | Adds postponed-annotations future import. |
| tests/metrics/conftest.py | Adds postponed-annotations future import and modernizes one Optional[...] annotation to ` |
| tests/key_points/test_skeletons.py | Adds postponed-annotations future import. |
| tests/key_points/test_core.py | Adds postponed-annotations future import. |
| tests/key_points/test_annotators.py | Adds postponed-annotations future import. |
| tests/geometry/test_utils.py | Adds postponed-annotations future import. |
| tests/geometry/test_core.py | Adds postponed-annotations future import. |
| tests/detection/utils/test_vlms.py | Adds postponed-annotations future import. |
| tests/detection/test_polygonzone.py | Adds postponed-annotations future import. |
| tests/detection/test_polygon_zone_annotator.py | Adds postponed-annotations future import. |
| tests/conftest.py | Adds postponed-annotations future import. |
| tests/assets/test_list.py | Adds postponed-annotations future import. |
| tests/assets/test_downloader.py | Adds postponed-annotations future import. |
| tests/annotators/test_docs.py | Adds postponed-annotations future import after module docstring. |
| tests/annotators/test_core.py | Adds postponed-annotations future import after module docstring. |
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request ports the useful Python typing and validation refinements from #2260 while keeping the branch focused.
Summary:
Compatibility note: