| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Thanks @dr-carlos for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15. |
Sorry, something went wrong.
|
GH-155707 is a backport of this pull request to the 3.15 branch. |
Sorry, something went wrong.
|
GH-155708 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
Test that re-evaluating a `ForwardRef` with `STRING` format uses the cache
…55707) Co-authored-by: dr-carlos <77367421+dr-carlos@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
Currently, every ForwardRef.evaluate(format=Format.STRING) test in test_annotationlib is done with an empty __resolved_string_cache__, so there is no test that re-evaluations are correct (or that they actually use the cache).
That is to say, the condition self.__resolved_str_cache__ is None is always true:
cpython/Lib/annotationlib.py
Line 244 in 025e7d2
Thus, this PR adds a simple test to re-stringify a stringified fwdref.
That said, I'm not 100% on whether the current test is correct: it's testing the behaviour that the cache has to be returned identically - which is the correct behaviour, and this test already tests the content of the cache - but I'm not sure if we want to cement that exact behaviour. So, happy to make it an equality (instead of identity) check if it's preferred.