File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1926,6 +1926,26 @@ def test_fwdref_invalid_syntax(self):
19261926 with self .assertRaises (SyntaxError ):
19271927 fr .evaluate ()
19281928
1929+ def test_re_evaluate_generics (self ):
1930+ global global_alias
1931+
1932+ # If we've already run this test before,
1933+ # ensure the variable is still undefined
1934+ if "global_alias" in globals ():
1935+ del global_alias
1936+
1937+ class C :
1938+ x : global_alias [int ]
1939+
1940+ # Evaluate the ForwardRef once
1941+ evaluated = get_annotations (C , format = Format .FORWARDREF )["x" ].evaluate (
1942+ format = Format .FORWARDREF
1943+ )
1944+
1945+ # Now define the global and ensure that the ForwardRef evaluates
1946+ global_alias = list
1947+ self .assertEqual (evaluated .evaluate (), list [int ])
1948+
19291949
19301950class TestAnnotationLib (unittest .TestCase ):
19311951 def test__all__ (self ):
You can’t perform that action at this time.
0 commit comments