We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ade5f8e commit f3b6293Copy full SHA for f3b6293
Lib/test/test_annotationlib.py
@@ -1962,9 +1962,13 @@ def test_forward_repr(self):
1962
)
1963
1964
def test_forward_repr_extra_names(self):
1965
- fr = ForwardRef("__annotationlib_name_1__")
1966
- fr.__extra_names__ = {"__annotationlib_name_1__": list[str]}
1967
- self.assertEqual(repr(fr), "ForwardRef('list[str]')")
+ def f(a: undefined | str): ...
+
+ annos = get_annotations(f, format=Format.FORWARDREF)
1968
1969
+ self.assertRegex(
1970
+ repr(annos['a']), r"ForwardRef\('undefined \| str'.*\)"
1971
+ )
1972
1973
def test_forward_recursion_actually(self):
1974
def namespace1():
0 commit comments