Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Testing, week 1 #50

Closed
wants to merge 5 commits into from
Closed

Testing, week 1 #50

wants to merge 5 commits into from

Conversation

nightblure
Copy link

No description provided.



@pytest.fixture
def user() -> User:

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

Suggested change
def user() -> User:
def user() -> Iterator[User]:


@pytest.fixture(scope="session")
def request_factory():
yield RequestFactory()

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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: nice catch.

@nightblure nightblure closed this by deleting the head repository Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants