mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-07 01:22:59 +08:00
first commit
This commit is contained in:
26
third_party/pybind11/tests/test_async.py
vendored
Normal file
26
third_party/pybind11/tests/test_async.py
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import pytest
|
||||
|
||||
asyncio = pytest.importorskip("asyncio")
|
||||
m = pytest.importorskip("pybind11_tests.async_module")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def event_loop():
|
||||
loop = asyncio.new_event_loop()
|
||||
yield loop
|
||||
loop.close()
|
||||
|
||||
|
||||
async def get_await_result(x):
|
||||
return await x
|
||||
|
||||
|
||||
def test_await(event_loop):
|
||||
assert 5 == event_loop.run_until_complete(
|
||||
get_await_result(m.SupportsAsync()))
|
||||
|
||||
|
||||
def test_await_missing(event_loop):
|
||||
with pytest.raises(TypeError):
|
||||
event_loop.run_until_complete(
|
||||
get_await_result(m.DoesNotSupportAsync()))
|
Reference in New Issue
Block a user