-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
gh-141174: Improve annotationlib.get_annotations() test coverage
#141286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…s on custom objects
…s on wrapped partial functions
…t stringized annotations
|
Thanks @dr-carlos for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…age (pythonGH-141286) * Test `get_annotations(format=Format.VALUE)` for stringized annotations on custom objects * Test `get_annotations(format=Format.VALUE)` for stringized annotations on wrapped partial functions * Update test_stringized_annotations_with_star_unpack() to actually test stringized annotations * Test __annotate__ returning a non-dict * Test passing globals and locals to stringized `get_annotations()` (cherry picked from commit 06b6228) Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
|
GH-141353 is a backport of this pull request to the 3.14 branch. |
…rage (GH-141286) (#141353) gh-141174: Improve `annotationlib.get_annotations()` test coverage (GH-141286) * Test `get_annotations(format=Format.VALUE)` for stringized annotations on custom objects * Test `get_annotations(format=Format.VALUE)` for stringized annotations on wrapped partial functions * Update test_stringized_annotations_with_star_unpack() to actually test stringized annotations * Test __annotate__ returning a non-dict * Test passing globals and locals to stringized `get_annotations()` (cherry picked from commit 06b6228) Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
|
This seems to be a false positive - obviously this commit doesn't touch |
|
Petr said that that test is being disabled on buildbots, it's frequently flaky. |
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.