kopia lustrzana https://github.com/micropython/micropython-lib
inspect: Implement iscoroutinefunction and iscoroutine.
Signed-off-by: Damien George <damien@micropython.org>master v1.25.0
rodzic
2665047fa7
commit
5b496e944e
|
@ -25,6 +25,11 @@ def isgenerator(obj):
|
|||
return isinstance(obj, type((_g)()))
|
||||
|
||||
|
||||
# In MicroPython there's currently no way to distinguish between generators and coroutines.
|
||||
iscoroutinefunction = isgeneratorfunction
|
||||
iscoroutine = isgenerator
|
||||
|
||||
|
||||
class _Class:
|
||||
def meth():
|
||||
pass
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
metadata(version="0.1.2")
|
||||
metadata(version="0.1.3")
|
||||
|
||||
module("inspect.py")
|
||||
|
|
|
@ -44,6 +44,12 @@ class TestInspect(unittest.TestCase):
|
|||
def test_isgenerator(self):
|
||||
self._test_is_helper(inspect.isgenerator, entities[2])
|
||||
|
||||
def test_iscoroutinefunction(self):
|
||||
self._test_is_helper(inspect.iscoroutinefunction, entities[1])
|
||||
|
||||
def test_iscoroutine(self):
|
||||
self._test_is_helper(inspect.iscoroutine, entities[2])
|
||||
|
||||
def test_ismethod(self):
|
||||
self._test_is_helper(inspect.ismethod, entities[5])
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue