Skip to content

Conversation

@dr-carlos
Copy link
Contributor

@dr-carlos dr-carlos commented Nov 6, 2025

All lines in the ForwardRef class (except _evaluate) should now be covered by tests, except

elif callable(owner):
globals = getattr(owner, "__globals__", None)

I couldn't think of a useful test for those lines that wouldn't involve using the undocumented ForwardRef constructor (as the owner is automatically applied by annotationlib.get_annotations()).

@bedevere-app bedevere-app bot added awaiting review tests Tests in the Lib/test dir labels Nov 6, 2025
@JelleZijlstra JelleZijlstra enabled auto-merge (squash) November 10, 2025 14:53
@JelleZijlstra JelleZijlstra merged commit 19b5730 into python:main Nov 10, 2025
50 checks passed
@JelleZijlstra JelleZijlstra added the needs backport to 3.14 bugs and security fixes label Nov 10, 2025
@miss-islington-app
Copy link

Thanks @dr-carlos for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @dr-carlos for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 10, 2025
* Test unsupported format in ForwardRef.evaluate()

* Test dict cell closure with multiple variables

* Test all options in ForwardRef repr

* Test ForwardRef being a final class
(cherry picked from commit 19b573025e0aa569e7a34081116280133e33979a)

Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Nov 10, 2025

GH-141354 is a backport of this pull request to the 3.14 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 10, 2025
* Test unsupported format in ForwardRef.evaluate()

* Test dict cell closure with multiple variables

* Test all options in ForwardRef repr

* Test ForwardRef being a final class
(cherry picked from commit 19b5730)

Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Nov 10, 2025
@miss-islington-app
Copy link

Sorry @dr-carlos and @JelleZijlstra, I had trouble completing the backport.
Please retry by removing and re-adding the "needs backport to 3.14" label.
Please backport backport using cherry_picker on the command line.

cherry_picker 19b573025e0aa569e7a34081116280133e33979a 3.14

JelleZijlstra pushed a commit that referenced this pull request Nov 10, 2025
…1354)

gh-141174: Improve `ForwardRef` test coverage (GH-141175)

* Test unsupported format in ForwardRef.evaluate()

* Test dict cell closure with multiple variables

* Test all options in ForwardRef repr

* Test ForwardRef being a final class
(cherry picked from commit 19b5730)

Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
@dr-carlos dr-carlos deleted the fwdref-tests branch November 10, 2025 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants