From bdc76f0c7bcd011324b6001acc166c9e90593b00 Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Sun, 23 Jul 2017 11:07:49 +0200 Subject: Now the coroutine signature is determined by the caller --- src/tests/test.py | 1 - 1 file changed, 1 deletion(-) (limited to 'src/tests/test.py') diff --git a/src/tests/test.py b/src/tests/test.py index d882418..fdc3727 100644 --- a/src/tests/test.py +++ b/src/tests/test.py @@ -92,7 +92,6 @@ class ExtraTestCase(unittest.TestCase): @d1 def f1(x, y, z): pass - self.assertNotEqual(d1.__code__.co_filename, d2.__code__.co_filename) self.assertNotEqual(f1.__code__.co_filename, f2.__code__.co_filename) self.assertNotEqual(f1_orig.__code__.co_filename, -- cgit v1.2.1 From 15d908b3ce3db5607c75f7dff052b1541f73f534 Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Sun, 23 Jul 2017 17:18:05 +0200 Subject: Updated the docs --- src/tests/test.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/tests/test.py') diff --git a/src/tests/test.py b/src/tests/test.py index fdc3727..7eb8391 100644 --- a/src/tests/test.py +++ b/src/tests/test.py @@ -30,15 +30,25 @@ if sys.version >= '3.5': async def before_after(coro, *args, **kwargs): return "" + (await coro(*args, **kwargs)) + "" +@decorator +def coro_to_func(coro, *args, **kw): + return get_event_loop().run_until_complete(coro(*args, **kw)) class CoroutineTestCase(unittest.TestCase): - def test(self): + def test_before_after(self): @before_after async def coro(x): return x self.assertTrue(inspect.iscoroutinefunction(coro)) out = get_event_loop().run_until_complete(coro('x')) self.assertEqual(out, 'x') + + def test_coro_to_func(self): + @coro_to_func + async def coro(x): + return x + self.assertFalse(inspect.iscoroutinefunction(coro)) + self.assertEqual(coro('x'), 'x') ''') -- cgit v1.2.1