gh-141174: Improve annotationlib.get_annotations() test coverage
#141286
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.
All lines in
get_annotations(),_rewrite_star_unpack(), and_get_and_call_annotate()should now be covered by tests.Branch coverage for evaluating stringized annotations on classes with no module or a module which cannot be imported was intentionally not included, as I couldn't find a realistic case and it didn't seem like a behaviour that needed to be reproducible. Happy to add a new test for this.
Also happy to remove the test which covers the branch of 'what if we unwrap a partial object but functools has never been imported', as this isn't a very realistic situation either.