-
Notifications
You must be signed in to change notification settings - Fork 112
Conversation
|
||
|
||
@pytest.fixture | ||
def user() -> User: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: Wouldn't it be more accurate to use the Generator
type annotation? Or this is common practice?
https://docs.python.org/3.11/library/typing.html#typing.Generator
def user() -> User: | |
def user() -> Iterator[User]: |
|
||
@pytest.fixture(scope="session") | ||
def request_factory(): | ||
yield RequestFactory() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Why are we using a generator here?
There's no finalization logic. Using a generator should be slower than casual func.
Nevertheless, I would expect to see a function rather than a generator. And generator here makes me stop and think why.
@@ -33,7 +33,7 @@ def __call__( | |||
timeout=self._api_timeout, | |||
) | |||
response.raise_for_status() | |||
return UserResponse.parse_raw(response.text) | |||
return UserResponse.model_validate_json(response.text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: nice catch.
No description provided.