def test_asynchornize(self):
test_mock = Mock()
class TestClass:
@classmethod
def _get_db(cls):
db = Mock()
db._framework = asyncio_framework
return db
@metaprogramming.asynchronize
def sync(self):
test_mock()
testobj = TestClass()
self.assertTrue(isinstance(testobj.sync(), Future))
yield from testobj.sync()
self.assertTrue(test_mock.called)
评论列表
文章目录