Skip to content
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

Refactoring unit test cases #2796

Merged
merged 3 commits into from
Sep 7, 2023
Merged

Refactoring unit test cases #2796

merged 3 commits into from
Sep 7, 2023

Conversation

freddiewanah
Copy link
Contributor

Hello, first-time submitting PR here.

This PR improves the readability of the assert statements in the unit tests. These changes improve code quality (avoid test smells) by:

  • Using isinstance() is the more Pythonic way to check types, as it supports polymorphism, and also consistent with other test files within the project.

  • Simplifying code management. For example, instead of simply saying "application/octet-stream", use the parameter name(DEFAULT_HTTP_CONTENT_TYPE) so that developers could only update the value in one place.

Happy to update more related issues in the test code if needed :)

@freddiewanah freddiewanah requested a review from a team as a code owner July 24, 2023 05:35
@codecov
Copy link

codecov bot commented Jul 24, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (91d7e6a) 88.387% compared to head (605a4fa) 88.387%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #2796   +/-   ##
=========================================
  Coverage   88.387%   88.387%           
=========================================
  Files           92        92           
  Lines         7156      7156           
  Branches      1228      1228           
=========================================
  Hits          6325      6325           
  Misses         575       575           
  Partials       256       256           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ahopkins
Copy link
Member

ahopkins commented Sep 6, 2023

@freddiewanah Thanks for submitting this. Any time we get an opportunity to improve tests it is a huge win. I'd be super happy to have your help working more on tests or anywhere else that you would be interested in contributing.

@ahopkins ahopkins merged commit a5a9658 into sanic-org:main Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants