summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_asyncio/test_tasks.py4
-rw-r--r--Lib/test/test_inspect.py27
2 files changed, 28 insertions, 3 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index 0fe7676..c65d1f2 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -440,8 +440,8 @@ class BaseTaskTests:
coro_repr = repr(task._coro)
expected = (
- r'<CoroWrapper \w+.test_task_repr_partial_corowrapper'
- r'\.<locals>\.func\(1\)\(\) running, '
+ r'<coroutine object \w+\.test_task_repr_partial_corowrapper'
+ r'\.<locals>\.func at'
)
self.assertRegex(coro_repr, expected)
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 134b0cd..b9072e0 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -166,26 +166,51 @@ class TestPredicates(IsTestBase):
self.assertFalse(inspect.ismemberdescriptor(datetime.timedelta.days))
def test_iscoroutine(self):
+ async_gen_coro = async_generator_function_example(1)
gen_coro = gen_coroutine_function_example(1)
coro = coroutine_function_example(1)
self.assertFalse(
inspect.iscoroutinefunction(gen_coroutine_function_example))
+ self.assertFalse(
+ inspect.iscoroutinefunction(
+ functools.partial(functools.partial(
+ gen_coroutine_function_example))))
self.assertFalse(inspect.iscoroutine(gen_coro))
self.assertTrue(
inspect.isgeneratorfunction(gen_coroutine_function_example))
+ self.assertTrue(
+ inspect.isgeneratorfunction(
+ functools.partial(functools.partial(
+ gen_coroutine_function_example))))
self.assertTrue(inspect.isgenerator(gen_coro))
self.assertTrue(
inspect.iscoroutinefunction(coroutine_function_example))
+ self.assertTrue(
+ inspect.iscoroutinefunction(
+ functools.partial(functools.partial(
+ coroutine_function_example))))
self.assertTrue(inspect.iscoroutine(coro))
self.assertFalse(
inspect.isgeneratorfunction(coroutine_function_example))
+ self.assertFalse(
+ inspect.isgeneratorfunction(
+ functools.partial(functools.partial(
+ coroutine_function_example))))
self.assertFalse(inspect.isgenerator(coro))
- coro.close(); gen_coro.close() # silence warnings
+ self.assertTrue(
+ inspect.isasyncgenfunction(async_generator_function_example))
+ self.assertTrue(
+ inspect.isasyncgenfunction(
+ functools.partial(functools.partial(
+ async_generator_function_example))))
+ self.assertTrue(inspect.isasyncgen(async_gen_coro))
+
+ coro.close(); gen_coro.close(); # silence warnings
def test_isawaitable(self):
def gen(): yield