1
1
# This is test file for typing,
2
2
# No automatic testing is used at the moment. Just use your type checker and see if it works.
3
3
# Pytest here is used to make sure that runtime behavir matches with type checker expecter errors.
4
- from decopatch import DECORATED , function_decorator
4
+ from typing import Any , Callable
5
+
5
6
import pytest
6
7
8
+ from decopatch import DECORATED , function_decorator
9
+
7
10
8
11
def test_invalid_parameter ():
9
12
with pytest .raises (TypeError ):
@@ -15,7 +18,7 @@ def decorator_wint_invalid_param(fn=DECORATED):
15
18
16
19
def test_normal_decorator ():
17
20
@function_decorator
18
- def decorator (scope : str = "test" , fn = DECORATED ):
21
+ def decorator (scope = "test" , fn = DECORATED ): # type: (str, Any) -> Callable[..., Any]
19
22
assert isinstance (scope , str )
20
23
return fn
21
24
@@ -43,7 +46,7 @@ def decorated_with_valid_options():
43
46
def test_function_decorator_with_params ():
44
47
# Ok, should reveal correct type for `enable_stack_introspection`
45
48
@function_decorator (enable_stack_introspection = True )
46
- def decorator_with_params (scope : str = "test" , fn = DECORATED ):
49
+ def decorator_with_params (scope = "test" , fn = DECORATED ): # type: (str, Any) -> Callable[..., Any]
47
50
return fn
48
51
49
52
# Ok, should reveal correct type for `scope`
0 commit comments