deasync decorator to make async functions/methods synchronous.
Project description
deasync provides a decorator called deasync for Python 3.5 (or higher) to make async functions synchronous in places where only synchronous functions are expected, for example in unittest.TestCase:
from asyncio import sleep
from unittest import TestCase
from deasync import deasync
async def function42():
await sleep(0.001)
return 42
class TestFunction42(TestCase):
@deasync
async def test_function42(self):
result = await function42()
self.assertEquals(42, result)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
deasync-1.0.1.zip
(4.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deasync-1.0.1.zip.
File metadata
- Download URL: deasync-1.0.1.zip
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2fb7b986b478ad86dccac21d97c7a6f5faaf6547f5db7436fb43d82bbd64d24
|
|
| MD5 |
54e5997f94fe97797e9b86179236108d
|
|
| BLAKE2b-256 |
123d31fe5bc237f57f42657a3c3e319c90f1d4f391ca681f04e61ada4ea898ec
|
File details
Details for the file deasync-1.0.1-py3-none-any.whl.
File metadata
- Download URL: deasync-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd747220f656fdcd0ca60b042cb82883257f7dc8393eabf37fdcf380630c132f
|
|
| MD5 |
abcb6f3f9b00d6216d0bc09bd59f2174
|
|
| BLAKE2b-256 |
a8f12649dbacefa57f6485079e6139306aa4e838a83c465e8f13a1ec31900c6c
|