summaryrefslogtreecommitdiff
path: root/src/tests/test.py
diff options
context:
space:
mode:
authorMichele Simionato <michele.simionato@gmail.com>2017-06-03 14:40:11 +0200
committerMichele Simionato <michele.simionato@gmail.com>2017-06-03 14:40:11 +0200
commit238bf589eb6100f2da4efba3a9c9297adbd63bef (patch)
treeae41a8e377f6a0b95114511290e2b818428ed5a5 /src/tests/test.py
parente557fb1da60902e1ae2fe6f57acebe077c529f21 (diff)
downloadpython-decorator-git-238bf589eb6100f2da4efba3a9c9297adbd63bef.tar.gz
Preserving iscoroutinefunction for Python 3.5 coroutines
Diffstat (limited to 'src/tests/test.py')
-rw-r--r--src/tests/test.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/tests/test.py b/src/tests/test.py
index 8b74c3a..0e31053 100644
--- a/src/tests/test.py
+++ b/src/tests/test.py
@@ -23,6 +23,21 @@ def assertRaises(etype):
else:
raise Exception('Expected %s' % etype.__name__)
+if sys.version >= '3.5':
+ exec('''\
+class CoroutineTestCase(unittest.TestCase):
+ def test(self):
+ async def cor():
+ pass
+ self.assertTrue(inspect.iscoroutinefunction(cor))
+
+ @decorator
+ def identity(f, *args, **kwargs):
+ return f(*args, **kwargs)
+
+ self.assertTrue(inspect.iscoroutinefunction(identity(cor)))
+''')
+
class DocumentationTestCase(unittest.TestCase):
def test(self):