Example:
import pytest
@pytest.fixture
async def phrase():
return 'hello world'
@pytest.fixture
async def replaced(phrase):
return phrase.replace('hello', 'goodbye')
The method .replace
is yellow-colored and the warning says:
Unresolved attribute reference 'replace' for class 'Coroutine'
However, these fixtures are working. If I remove async
from def phrase():
Pycharm is handling .replace
correctly, showing that it is method of class str
. Is there any way to tell PyCharm that phrase
when used in replaced
will be an instance of str
, not a Coroutine
? Preferably, without code repetition for every fixture that will use phrase
.