@@ -52,16 +52,30 @@ def generic_spam[T](a):
52
52
class GenericMine[T: int]:
53
53
pass
54
54
55
- # test case: ComplexClass
55
+ # The following symbols are defined in ComplexClass
56
+ # without being introduced by a 'global' statement.
56
57
glob_unassigned_meth: int
57
58
glob_unassigned_meth_pep_695: int
59
+ glob_unassigned_async_meth: int
60
+ glob_unassigned_async_meth_pep_695: int
61
+
58
62
glob_assigned_meth = 1234
59
63
glob_assigned_meth_pep_695 = 1234
64
+ glob_assigned_async_meth = 1234
65
+ glob_assigned_async_meth_pep_695 = 1234
60
66
67
+ # The following symbols are defined in ComplexClass after
68
+ # being introduced by a 'global' statement (and therefore
69
+ # are not considered as methods of ComplexClass).
61
70
glob_unassigned_meth_ignore: int
62
71
glob_unassigned_meth_pep_695_ignore: int
72
+ glob_unassigned_async_meth_ignore: int
73
+ glob_unassigned_async_meth_pep_695_ignore: int
74
+
63
75
glob_assigned_meth_ignore = 1234
64
76
glob_assigned_meth_pep_695_ignore = 1234
77
+ glob_assigned_async_meth_ignore = 1234
78
+ glob_assigned_async_meth_pep_695_ignore = 1234
65
79
66
80
class ComplexClass:
67
81
some_non_method_const = 1234
@@ -78,40 +92,74 @@ class some_non_method_nested_pep_695[T]: pass
78
92
def a_method(self): pass
79
93
def a_method_pep_695[T](self): pass
80
94
95
+ async def an_async_method(self): pass
96
+ async def an_async_method_pep_695[T](self): pass
97
+
81
98
@classmethod
82
99
def a_classmethod(cls): pass
83
100
@classmethod
84
101
def a_classmethod_pep_695[T](self): pass
85
102
103
+ @classmethod
104
+ async def an_async_classmethod(cls): pass
105
+ @classmethod
106
+ async def an_async_classmethod_pep_695[T](self): pass
107
+
86
108
@staticmethod
87
109
def a_staticmethod(): pass
88
110
@staticmethod
89
111
def a_staticmethod_pep_695[T](self): pass
90
112
113
+ @staticmethod
114
+ def an_async_staticmethod(): pass
115
+ @staticmethod
116
+ def an_async_staticmethod_pep_695[T](self): pass
117
+
91
118
# These ones will be considered as methods because of the 'def' although
92
119
# they are *not* valid methods at runtime since they are not decorated
93
120
# with @staticmethod.
94
121
def a_fakemethod(): pass
95
122
def a_fakemethod_pep_695[T](): pass
96
123
124
+ async def an_async_fakemethod(): pass
125
+ async def an_async_fakemethod_pep_695[T](): pass
126
+
97
127
# Check that those are still considered as methods
98
128
# since they are not using the 'global' keyword.
99
129
def glob_unassigned_meth(): pass
100
130
def glob_unassigned_meth_pep_695[T](): pass
131
+
132
+ async def glob_unassigned_async_meth(): pass
133
+ async def glob_unassigned_async_meth_pep_695[T](): pass
134
+
101
135
def glob_assigned_meth(): pass
102
136
def glob_assigned_meth_pep_695[T](): pass
103
137
138
+ async def glob_assigned_async_meth(): pass
139
+ async def glob_assigned_async_meth_pep_695[T](): pass
140
+
104
141
# The following are not picked as a method because thy are not
105
142
# visible by the class at runtime (this is equivalent to having
106
143
# the definitions outside of the class).
107
144
global glob_unassigned_meth_ignore
108
145
def glob_unassigned_meth_ignore(): pass
109
146
global glob_unassigned_meth_pep_695_ignore
110
147
def glob_unassigned_meth_pep_695_ignore[T](): pass
148
+
149
+ global glob_unassigned_async_meth_ignore
150
+ async def glob_unassigned_async_meth_ignore(): pass
151
+ global glob_unassigned_async_meth_pep_695_ignore
152
+ async def glob_unassigned_async_meth_pep_695_ignore[T](): pass
153
+
111
154
global glob_assigned_meth_ignore
112
155
def glob_assigned_meth_ignore(): pass
113
156
global glob_assigned_meth_pep_695_ignore
114
157
def glob_assigned_meth_pep_695_ignore[T](): pass
158
+
159
+ global glob_assigned_async_meth_ignore
160
+ async def glob_assigned_async_meth_ignore(): pass
161
+ global glob_assigned_async_meth_pep_695_ignore
162
+ async def glob_assigned_async_meth_pep_695_ignore[T](): pass
115
163
"""
116
164
117
165
@@ -305,11 +353,17 @@ def test_class_info(self):
305
353
306
354
self .assertEqual (self .ComplexClass .get_methods (), (
307
355
'a_method' , 'a_method_pep_695' ,
356
+ 'an_async_method' , 'an_async_method_pep_695' ,
308
357
'a_classmethod' , 'a_classmethod_pep_695' ,
358
+ 'an_async_classmethod' , 'an_async_classmethod_pep_695' ,
309
359
'a_staticmethod' , 'a_staticmethod_pep_695' ,
360
+ 'an_async_staticmethod' , 'an_async_staticmethod_pep_695' ,
310
361
'a_fakemethod' , 'a_fakemethod_pep_695' ,
362
+ 'an_async_fakemethod' , 'an_async_fakemethod_pep_695' ,
311
363
'glob_unassigned_meth' , 'glob_unassigned_meth_pep_695' ,
364
+ 'glob_unassigned_async_meth' , 'glob_unassigned_async_meth_pep_695' ,
312
365
'glob_assigned_meth' , 'glob_assigned_meth_pep_695' ,
366
+ 'glob_assigned_async_meth' , 'glob_assigned_async_meth_pep_695' ,
313
367
))
314
368
315
369
def test_filename_correct (self ):
0 commit comments