-
Hello! I have an example pytest fixture that uses
Mypy gives an error How can I type that fixture, so mypy understands it? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I'd expect |
Beta Was this translation helpful? Give feedback.
-
from typing import Generator
@pytest.fixture()
def foo() -> Generator[str, None, None]:
yield "foo" I'm hoping one day generics could have defaults, in which case the type would be just |
Beta Was this translation helpful? Give feedback.
Iterator[str]
is actually not strong enough; the correct incantation isI'm hoping one day generics could have defaults, in which case the type would be just
Generator[str]
, but for now the full thing is needed.