from unittest import mock async def my_async_func(): await some_async_operation() return "done" async def my_async_coro(): return "done" async def my_async_context_manager(): async with some_async_context() as obj: obj.do_something() return "done" # Mocking an asynchronous function mock_async_func = mock.AsyncMock() result = await mock_async_func() mock_async_func.assert_not_called() # Mocking an asynchronous coroutine mock_async_coro = mock.AsyncMock() result = await mock_async_coro() mock_async_coro.assert_not_called() # Mocking an asynchronous context manager mock_async_context_manager = mock.AsyncMock() async with mock_async_context_manager: pass mock_async_context_manager.__aenter__.assert_not_called() mock_async_context_manager.__aexit__.assert_not_called()The package library used in this example is the standard unittest.mock library that comes with Python.