[3.15] gh-141174: Test re-stringifying a `ForwardRef` (GH-155689) (#155707)
hugovk <[email protected]>
| Newsgroups | gmane.comp.python.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://github.com/python/cpython/commit/be6e78928f51880034af4486650c377f477c8450 commit: be6e78928f51880034af4486650c377f477c8450 branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: hugovk <[email protected]> date: 2026-08-19T05:25:55+03:00 summary: [3.15] gh-141174: Test re-stringifying a `ForwardRef` (GH-155689) (#155707) Co-authored-by: dr-carlos <[email protected]> files: M Lib/test/test_annotationlib.py diff --git a/Lib/test/test_annotationlib.py b/Lib/test/test_annotationlib.py index 5087c3ca425f1f..5bfcf5ce4131e3 100644 --- a/Lib/test/test_annotationlib.py +++ b/Lib/test/test_annotationlib.py @@ -2133,8 +2133,13 @@ def f(a: unknown | str | int | list[str] | tuple[int, ...]): ... self.assertIsNone(fr.__resolved_str_cache__) self.assertEqual(fr.evaluate(format=Format.STRING), "unknown | str | int | list[str] | tuple[int, ...]") + + # Test that the cache is now set correctly self.assertEqual(fr.__resolved_str_cache__, "unknown | str | int | list[str] | tuple[int, ...]") + # Test that future evaluations return the same cache + self.assertIs(fr.evaluate(format=Format.STRING), fr.__resolved_str_cache__) + def test_evaluate_forwardref_format(self): fr = ForwardRef("undef") evaluated = fr.evaluate(format=Format.FORWARDREF) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]