-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
refactor: Refactored test_assertions.py
file.
#23584
Conversation
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.
PR Compliance Checks
Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.
Issue Reference
In order to be considered for merging, the pull request description must refer to a specific issue number. This is described in our contributing guide and our PR template.
This check is looking for a phrase similar to: "Fixes #XYZ" or "Resolves #XYZ" where XYZ is the issue number that this PR is meant to address.
test_assertions.py
file.test_assertions.py
file.
@Sai-Suraj-27, Can you please tag the issue for which these changes were required to be made. Thanks |
Sir, I made these on my own to make the code better and clean. This is a refactoring PR. It's not related to any issue. |
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.
Hey @Sai-Suraj-27, just requested a minor change, rest looks good to merge, thanks 😄(thanks for requesting the review @Mr-Niraj-Kulkarni)
sys.stdout = orig_stdout | ||
f.close() | ||
|
||
with open(filename, "w") as f: |
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.
let's add a new line before and after this block similar to how it's done with the next blocks in this function. Same applies to the other changes made
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.
@vedpatwardhan sir, I made the suggested changes, Please look into it now, Thank you.
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.
lgtm! Feel free to merge the PR @Mr-Niraj-Kulkarni, thanks @Sai-Suraj-27 😄
PR Description
Refactored
test_assertions.py
file. Usedwith
when opening files to ensure closure, as opening files in this way is more concise, and also ensures that the call tofile.close()
is not skipped if there is an exception. Also, removed unnecessary calls to.keys()
when iterating over a dictionary as the default behaviour when iterating over a dictionary is to iterate over the keys.Checklist
Socials: