File tree 1 file changed +31
-0
lines changed 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,37 @@ def wrapper(*args: P.args, **kwargs: P.kwargs) -> T_co:
23
23
return wrapper
24
24
25
25
26
+ def check_wraps_function () -> None :
27
+ def wrapped (x : int ) -> None : ...
28
+ @wraps (wrapped )
29
+ def identical_wrapper (x : int ) -> None : ...
30
+ @wraps (wrapped )
31
+ def other_signature_wrapper (x : str , y : float ) -> None : ...
32
+
33
+ identical_wrapper (3 )
34
+ other_signature_wrapper ("parrot" , 42.0 )
35
+
36
+
37
+ def check_wraps_method () -> None :
38
+ class Wrapped :
39
+ def wrapped (self , x : int ) -> None : ...
40
+ @wraps (wrapped )
41
+ def wrapper (self , x : int ) -> None : ...
42
+
43
+ class Wrapper : # pyright: ignore[reportUnusedClass]
44
+ @wraps (Wrapped .wrapped )
45
+ def method (self , x : int ) -> None : ...
46
+
47
+ @wraps (Wrapped .wrapped )
48
+ def func_wrapper (x : int ) -> None : ...
49
+
50
+ # TODO: The following should work, but currently don't.
51
+ # https://github.com/python/typeshed/issues/10653
52
+ # Wrapped().wrapper(3)
53
+ # Wrapper().method(3)
54
+ func_wrapper (3 )
55
+
56
+
26
57
class A :
27
58
def __init__ (self , x : int ):
28
59
self .x = x
You can’t perform that action at this time.
0 commit comments