If it is not async function and just return host_output function and another_host_output, the test were all passed. However, when I changed it with the async function, the tests started failing. How can I solve the value error in this situation?
async def get_host_output(host, output=True):
// some more code here
if output:
async for i in host_output(hosts=host):
yield i
else:
async for j in another_host_output(hosts=host):
yield j
test case
def test_with_host():
// some codes here
mocking_response= mock_response()
with.pytest.raises(ValueError):
mocking_response.get_host_output(hosts=host) // return asynchronous gernerator object
// tried to input a fake host to trigger the Value error, but still failed.
assert mocking_response.get_host_output(hosts='123')