@@ -167,12 +167,33 @@ def test_iscoroutine(self):
167
167
gen_coro = gen_coroutine_function_example (1 )
168
168
coro = coroutine_function_example (1 )
169
169
170
+ class PMClass :
171
+ async_generator_partialmethod_example = functools .partialmethod (
172
+ async_generator_function_example )
173
+ coroutine_partialmethod_example = functools .partialmethod (
174
+ coroutine_function_example )
175
+ gen_coroutine_partialmethod_example = functools .partialmethod (
176
+ gen_coroutine_function_example )
177
+
178
+ # partialmethods on the class, bound to an instance
179
+ pm_instance = PMClass ()
180
+ async_gen_coro_pmi = pm_instance .async_generator_partialmethod_example
181
+ gen_coro_pmi = pm_instance .gen_coroutine_partialmethod_example
182
+ coro_pmi = pm_instance .coroutine_partialmethod_example
183
+
184
+ # partialmethods on the class, unbound but accessed via the class
185
+ async_gen_coro_pmc = PMClass .async_generator_partialmethod_example
186
+ gen_coro_pmc = PMClass .gen_coroutine_partialmethod_example
187
+ coro_pmc = PMClass .coroutine_partialmethod_example
188
+
170
189
self .assertFalse (
171
190
inspect .iscoroutinefunction (gen_coroutine_function_example ))
172
191
self .assertFalse (
173
192
inspect .iscoroutinefunction (
174
193
functools .partial (functools .partial (
175
194
gen_coroutine_function_example ))))
195
+ self .assertFalse (inspect .iscoroutinefunction (gen_coro_pmi ))
196
+ self .assertFalse (inspect .iscoroutinefunction (gen_coro_pmc ))
176
197
self .assertFalse (inspect .iscoroutine (gen_coro ))
177
198
178
199
self .assertTrue (
@@ -181,6 +202,8 @@ def test_iscoroutine(self):
181
202
inspect .isgeneratorfunction (
182
203
functools .partial (functools .partial (
183
204
gen_coroutine_function_example ))))
205
+ self .assertTrue (inspect .isgeneratorfunction (gen_coro_pmi ))
206
+ self .assertTrue (inspect .isgeneratorfunction (gen_coro_pmc ))
184
207
self .assertTrue (inspect .isgenerator (gen_coro ))
185
208
186
209
self .assertTrue (
@@ -189,6 +212,8 @@ def test_iscoroutine(self):
189
212
inspect .iscoroutinefunction (
190
213
functools .partial (functools .partial (
191
214
coroutine_function_example ))))
215
+ self .assertTrue (inspect .iscoroutinefunction (coro_pmi ))
216
+ self .assertTrue (inspect .iscoroutinefunction (coro_pmc ))
192
217
self .assertTrue (inspect .iscoroutine (coro ))
193
218
194
219
self .assertFalse (
@@ -197,6 +222,8 @@ def test_iscoroutine(self):
197
222
inspect .isgeneratorfunction (
198
223
functools .partial (functools .partial (
199
224
coroutine_function_example ))))
225
+ self .assertFalse (inspect .isgeneratorfunction (coro_pmi ))
226
+ self .assertFalse (inspect .isgeneratorfunction (coro_pmc ))
200
227
self .assertFalse (inspect .isgenerator (coro ))
201
228
202
229
self .assertTrue (
@@ -205,6 +232,8 @@ def test_iscoroutine(self):
205
232
inspect .isasyncgenfunction (
206
233
functools .partial (functools .partial (
207
234
async_generator_function_example ))))
235
+ self .assertTrue (inspect .isasyncgenfunction (async_gen_coro_pmi ))
236
+ self .assertTrue (inspect .isasyncgenfunction (async_gen_coro_pmc ))
208
237
self .assertTrue (inspect .isasyncgen (async_gen_coro ))
209
238
210
239
coro .close (); gen_coro .close (); # silence warnings
0 commit comments