ext: Updated Pybind11 to version 2.4.1.
[gem5.git] / ext / pybind11 / tests / test_async.py
1 import asyncio
2 import pytest
3 from pybind11_tests import async_module as m
4
5
6 @pytest.fixture
7 def event_loop():
8 loop = asyncio.new_event_loop()
9 yield loop
10 loop.close()
11
12
13 async def get_await_result(x):
14 return await x
15
16
17 def test_await(event_loop):
18 assert 5 == event_loop.run_until_complete(get_await_result(m.SupportsAsync()))
19
20
21 def test_await_missing(event_loop):
22 with pytest.raises(TypeError):
23 event_loop.run_until_complete(get_await_result(m.DoesNotSupportAsync()))