File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -7152,6 +7152,25 @@ class C:
7152
7152
self .assertEqual (get_type_hints (C , format = annotationlib .Format .STRING ),
7153
7153
{'x' : 'undefined' })
7154
7154
7155
+ def test_get_type_hints_format_function (self ):
7156
+ def func (x : undefined ) -> undefined : ...
7157
+
7158
+ # VALUE
7159
+ with self .assertRaises (NameError ):
7160
+ get_type_hints (func )
7161
+ with self .assertRaises (NameError ):
7162
+ get_type_hints (func , format = annotationlib .Format .VALUE )
7163
+
7164
+ # FORWARDREF
7165
+ self .assertEqual (
7166
+ get_type_hints (func , format = annotationlib .Format .FORWARDREF ),
7167
+ {'x' : ForwardRef ('undefined' ), 'return' : ForwardRef ('undefined' )},
7168
+ )
7169
+
7170
+ # STRING
7171
+ self .assertEqual (get_type_hints (func , format = annotationlib .Format .STRING ),
7172
+ {'x' : 'undefined' , 'return' : 'undefined' })
7173
+
7155
7174
7156
7175
class GetUtilitiesTestCase (TestCase ):
7157
7176
def test_get_origin (self ):
You can’t perform that action at this time.
0 commit comments