File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from dataclasses import dataclass
2+
3+
4+ def forwardref_method (foo : "ForwardRef" , bar : str ) -> "ForwardRef" :
5+ return foo .x + bar
6+
7+
8+ @dataclass
9+ class ForwardRef :
10+ x : str = "default"
Original file line number Diff line number Diff line change @@ -253,3 +253,19 @@ def test_issue_77_async_generator_partial():
253253 assert inspect .isasyncgenfunction (f_partial )
254254
255255 assert asyncio .get_event_loop ().run_until_complete (asyncio .ensure_future (f_partial ().__anext__ ())) == 1
256+
257+
258+ def test_issue_85_wrapped_forwardref_annotation ():
259+ import typing
260+ from . import issue_85_module
261+
262+ @wraps (issue_85_module .forwardref_method , remove_args = ["bar" ])
263+ def decorated (* args , ** kwargs ):
264+ return issue_85_module .forwardref_method (* args , ** kwargs , bar = "x" )
265+
266+ assert decorated (issue_85_module .ForwardRef ()) == "defaultx"
267+ expected_annotations = {
268+ "foo" : issue_85_module .ForwardRef ,
269+ "return" : issue_85_module .ForwardRef ,
270+ }
271+ assert typing .get_type_hints (decorated ) == expected_annotations
You can’t perform that action at this time.
0 commit comments