@@ -186,12 +186,33 @@ def test_iscoroutine(self):
186
186
gen_coro = gen_coroutine_function_example (1 )
187
187
coro = coroutine_function_example (1 )
188
188
189
+ class PMClass :
190
+ async_generator_partialmethod_example = functools .partialmethod (
191
+ async_generator_function_example )
192
+ coroutine_partialmethod_example = functools .partialmethod (
193
+ coroutine_function_example )
194
+ gen_coroutine_partialmethod_example = functools .partialmethod (
195
+ gen_coroutine_function_example )
196
+
197
+ # partialmethods on the class, bound to an instance
198
+ pm_instance = PMClass ()
199
+ async_gen_coro_pmi = pm_instance .async_generator_partialmethod_example
200
+ gen_coro_pmi = pm_instance .gen_coroutine_partialmethod_example
201
+ coro_pmi = pm_instance .coroutine_partialmethod_example
202
+
203
+ # partialmethods on the class, unbound but accessed via the class
204
+ async_gen_coro_pmc = PMClass .async_generator_partialmethod_example
205
+ gen_coro_pmc = PMClass .gen_coroutine_partialmethod_example
206
+ coro_pmc = PMClass .coroutine_partialmethod_example
207
+
189
208
self .assertFalse (
190
209
inspect .iscoroutinefunction (gen_coroutine_function_example ))
191
210
self .assertFalse (
192
211
inspect .iscoroutinefunction (
193
212
functools .partial (functools .partial (
194
213
gen_coroutine_function_example ))))
214
+ self .assertFalse (inspect .iscoroutinefunction (gen_coro_pmi ))
215
+ self .assertFalse (inspect .iscoroutinefunction (gen_coro_pmc ))
195
216
self .assertFalse (inspect .iscoroutine (gen_coro ))
196
217
197
218
self .assertTrue (
@@ -200,6 +221,8 @@ def test_iscoroutine(self):
200
221
inspect .isgeneratorfunction (
201
222
functools .partial (functools .partial (
202
223
gen_coroutine_function_example ))))
224
+ self .assertTrue (inspect .isgeneratorfunction (gen_coro_pmi ))
225
+ self .assertTrue (inspect .isgeneratorfunction (gen_coro_pmc ))
203
226
self .assertTrue (inspect .isgenerator (gen_coro ))
204
227
205
228
async def _fn3 ():
@@ -257,6 +280,8 @@ def do_something_static():
257
280
inspect .iscoroutinefunction (
258
281
functools .partial (functools .partial (
259
282
coroutine_function_example ))))
283
+ self .assertTrue (inspect .iscoroutinefunction (coro_pmi ))
284
+ self .assertTrue (inspect .iscoroutinefunction (coro_pmc ))
260
285
self .assertTrue (inspect .iscoroutine (coro ))
261
286
262
287
self .assertFalse (
@@ -269,6 +294,8 @@ def do_something_static():
269
294
inspect .isgeneratorfunction (
270
295
functools .partial (functools .partial (
271
296
coroutine_function_example ))))
297
+ self .assertFalse (inspect .isgeneratorfunction (coro_pmi ))
298
+ self .assertFalse (inspect .isgeneratorfunction (coro_pmc ))
272
299
self .assertFalse (inspect .isgenerator (coro ))
273
300
274
301
self .assertFalse (
@@ -283,6 +310,8 @@ def do_something_static():
283
310
inspect .isasyncgenfunction (
284
311
functools .partial (functools .partial (
285
312
async_generator_function_example ))))
313
+ self .assertTrue (inspect .isasyncgenfunction (async_gen_coro_pmi ))
314
+ self .assertTrue (inspect .isasyncgenfunction (async_gen_coro_pmc ))
286
315
self .assertTrue (inspect .isasyncgen (async_gen_coro ))
287
316
288
317
coro .close (); gen_coro .close (); # silence warnings
0 commit comments