Closed
Description
└─> py.test giphynavigator/tests.py --cov=giphynavigator
=============================================================================================== test session starts ================================================================================================
platform darwin -- Python 3.10.13, pytest-7.4.4, pluggy-1.3.0
rootdir: /Users/I530566/devel/mine/hamradio/tmp/python-dependency-injector
plugins: asyncio-0.23.3, cov-4.1.0, anyio-4.2.0
asyncio: mode=strict
collected 3 items
giphynavigator/tests.py FFF [100%]
=======================================
6812
============================================================== FAILURES =====================================================================================================
____________________________________________________________________________________________________ test_index ____________________________________________________________________________________________________
client = <async_generator object client at 0x106dd7240>
@pytest.mark.asyncio
async def test_index(client):
giphy_client_mock = mock.AsyncMock(spec=GiphyClient)
giphy_client_mock.search.return_value = {
"data": [
{"url": "https://giphy.com/gif1.gif"},
{"url": "https://giphy.com/gif2.gif"},
],
}
with app.container.giphy_client.override(giphy_client_mock):
> response = await client.get(
"/",
params={
"query": "test",
"limit": 10,
},
)
E AttributeError: 'async_generator' object has no attribute 'get'
giphynavigator/tests.py:29: AttributeError
________________________________________________________________________________________________ test_index_no_data ________________________________________________________________________________________________
client = <async_generator object client at 0x106e2c2c0>
@pytest.mark.asyncio
async def test_index_no_data(client):
giphy_client_mock = mock.AsyncMock(spec=GiphyClient)
giphy_client_mock.search.return_value = {
"data": [],
}
with app.container.giphy_client.override(giphy_client_mock):
> response = await client.get("/")
E AttributeError: 'async_generator' object has no attribute 'get'
giphynavigator/tests.py:57: AttributeError
____________________________________________________________________________________________ test_index_default_params _____________________________________________________________________________________________
client = <async_generator object client at 0x105c3fbc0>
@pytest.mark.asyncio
async def test_index_default_params(client):
giphy_client_mock = mock.AsyncMock(spec=GiphyClient)
giphy_client_mock.search.return_value = {
"data": [],
}
with app.container.giphy_client.override(giphy_client_mock):
> response = await client.get("/")
E AttributeError: 'async_generator' object has no attribute 'get'
giphynavigator/tests.py:72: AttributeError
================================================================================================= warnings summary =================================================================================================
../../../../../../../../.pyenv/versions/3.10.13/lib/python3.10/inspect.py:469
../../../../../../../../.pyenv/versions/3.10.13/lib/python3.10/inspect.py:469
../../../../../../../../.pyenv/versions/3.10.13/lib/python3.10/inspect.py:469
/Users/I530566/.pyenv/versions/3.10.13/lib/python3.10/inspect.py:469: PydanticDeprecatedSince20: The `__fields__` attribute is deprecated, use `model_fields` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/
value = getattr(object, key)
.venv/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py:248
.venv/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py:248
.venv/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py:248
/Users/I530566/devel/mine/hamradio/tmp/python-dependency-injector/examples/miniapps/fastapi/.venv/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py:248: PydanticDeprecatedSince20: The `__fields__` attribute is deprecated, use `model_fields` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/
warnings.warn('The `__fields__` attribute is deprecated, use `model_fields` instead.', DeprecationWarning)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
--------- coverage: platform darwin, python 3.10.13-final-0 ----------
Name Stmts Miss Cover
---------------------------------------------------
giphynavigator/__init__.py 0 0 100%
giphynavigator/application.py 11 0 100%
giphynavigator/containers.py 7 0 100%
giphynavigator/endpoints.py 20 4 80%
giphynavigator/giphy.py 14 9 36%
giphynavigator/services.py 9 5 44%
giphynavigator/tests.py 37 12 68%
---------------------------------------------------
TOTAL 98 30 69%
============================================================================================= short test summary info ==============================================================================================
FAILED giphynavigator/tests.py::test_index - AttributeError: 'async_generator' object has no attribute 'get'
FAILED giphynavigator/tests.py::test_index_no_data - AttributeError: 'async_generator' object has no attribute 'get'
FAILED giphynavigator/tests.py::test_index_default_params - AttributeError: 'async_generator' object has no attribute 'get'
========================================================================================== 3 failed, 6 warnings in 1.42s ===========================================================================================