-
-
Notifications
You must be signed in to change notification settings - Fork 226
fix: Prevent duplicate return types in generated api functions #365
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #365 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 47 47
Lines 1483 1490 +7
=========================================
+ Hits 1483 1490 +7
Continue to review full report at Codecov.
|
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.
A question and a suggestion but LGTM as far as implementation goes.
@@ -265,6 +265,15 @@ def from_data( | |||
|
|||
return result, schemas | |||
|
|||
def response_type(self) -> str: |
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.
Any reason this isn't a @property
?
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.
Generally bad practice to make something a property if it does a bunch of work. The method call ()
indicates to the caller that something is happening, so if you need it twice you should assign it to a variable rather than calling it twice.
@@ -114,6 +118,19 @@ def test_from_dict_invalid_version(self, mocker): | |||
|
|||
|
|||
class TestEndpoint: | |||
def make_endpoint(self): |
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 feel like it probably makes more sense to either just make this a fixture or take advantage of setup_method
to set self.endpoint
to be the default endpoint constructed below.
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 considered a fixture, but you don't really gain anything here since it's not dependent on other fixtures. It's still going to call it every time, just with the overhead of pytest wrangling. setup_method
could work, but I still hate it 😂. Totally unclear to most pytest users what that does IMO.
No description provided.