-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve some nits in the codebase #708
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #708 +/- ##
=======================================
Coverage 92.17% 92.17%
=======================================
Files 35 35
Lines 1803 1803
=======================================
Hits 1662 1662
Misses 141 141 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
(some of these type: ignores may need to be reinstated for #619 |
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.
I like this! Just a few small comments.
@@ -18,7 +22,7 @@ def events(mock_stomp_client: StompClient) -> EventBusClient: | |||
|
|||
def test_context_manager_connects_and_disconnects( | |||
events: EventBusClient, | |||
mock_stomp_client: Mock, | |||
mock_stomp_client: StompClient, |
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.
Honestly I never know what to do with type annotations for mocks. If you annotated with the mocked type you get code completion for its methods but you don't get assert_called_once
et al. and vice versa.
I tend to annotate based on whether I'm using the real methods or the mock utilities more often but we should probably have a cohesive answer. I've tried using Mock(spec=ActualType)
before but vscode doesn't seem to pick that up.
with pytest.raises(KeyError) as exception: | ||
client.get_plan("Not exists") | ||
assert str(exception) == ("{'detail': 'Item not found'}") | ||
assert str(exception) == ("{'detail': 'Item not found'}") |
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.
Could all these use raises(match='pattern')
instead of having a separate assert? Something like
with pytest.raises(KeyError, match=NOT_FOUND):
client.get_plan("Not exists")
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.
No description provided.