Вызов функции клиента выглядит следующим образом:
Код: Выделить всё
test.client.json().set(argumentsforquery)
Код: Выделить всё
@pytest.mark.asyncio
async def test_client(self):
self.test.client = AsyncMock()
with patch.object(self.test.client.json, 'set', return_value='FooBar') as mock:
print(await mock())
# FooBar
print(await self.test.client.json.set())
# FooBar
print(await self.test.client.json().set())
# AttributeError: 'coroutine' object has no attribute 'set'
Любые идеи как получить FooBar, вызвав await self.test.client.json().set()?
Подробнее здесь: https://stackoverflow.com/questions/792 ... sted-coros