-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Use plain asserts in tests #1448
Conversation
As Zach mentioned, we'll have an internal discussion first to ensure that we have consensus, as we want the HF code bases to be consistent when it comes to the testing style (we know they're not completely consistent right now, but mostly). |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Could you please run |
@BenjaminBossan Rebased, reformatted. |
@akx There are some instances of |
813fc25
to
861566e
Compare
9ec3e07
to
1003c39
Compare
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.
Thanks for all the work, this is much better on the eye!
Use pytest style asserts instead of unittest methods. Use `pytest.raises` and `pytest.warns` where suitable.
Use pytest style asserts instead of unittest methods. Use `pytest.raises` and `pytest.warns` where suitable.
Plain assertions are easier to debug than Unittest
self.assert*
s due to Pytest's assertion rewriting.Similar to huggingface/accelerate#2420, this was done via codemod-unittest-to-pytest-asserts and
ast-grep
.Sibling of huggingface/trl#1301.