13
13
# limitations under the License.
14
14
import functools
15
15
16
+
16
17
def exercise_function ():
17
18
return
18
19
19
20
20
- class ExerciseClass ():
21
+ class ExerciseClass (object ):
21
22
def exercise_method (self ):
22
23
return
23
24
@@ -30,12 +31,46 @@ def exercise_class_method(cls):
30
31
return
31
32
32
33
33
- class ExerciseClassCallable ():
34
+ class ExerciseClassCallable (object ):
34
35
def __call__ (self ):
35
36
return
36
37
38
+
39
+ def exercise_method (self ):
40
+ return
41
+
42
+
43
+ @staticmethod
44
+ def exercise_static_method ():
45
+ return
46
+
47
+
48
+ @classmethod
49
+ def exercise_class_method (cls ):
50
+ return
51
+
52
+
53
+ def __call__ (self ):
54
+ return
55
+
56
+
57
+ type_dict = {
58
+ "exercise_method" : exercise_method ,
59
+ "exercise_static_method" : exercise_static_method ,
60
+ "exercise_class_method" : exercise_class_method ,
61
+ "exercise_lambda" : lambda : None ,
62
+ }
63
+ callable_type_dict = type_dict .copy ()
64
+ callable_type_dict ["__call__" ] = __call__
65
+
66
+ ExerciseTypeConstructor = type ("ExerciseTypeConstructor" , (object ,), type_dict )
67
+ ExerciseTypeConstructorCallable = type ("ExerciseTypeConstructorCallable" , (object ,), callable_type_dict )
68
+
69
+
37
70
CLASS_INSTANCE = ExerciseClass ()
38
71
CLASS_INSTANCE_CALLABLE = ExerciseClassCallable ()
72
+ TYPE_CONSTRUCTOR_CLASS_INSTANCE = ExerciseTypeConstructor ()
73
+ TYPE_CONSTRUCTOR_CALLABLE_CLASS_INSTANCE = ExerciseTypeConstructorCallable ()
39
74
40
- exercise_lambda = lambda : None
75
+ exercise_lambda = lambda : None # noqa: E731
41
76
exercise_partial = functools .partial (exercise_function )
0 commit comments