-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Add test cases for dataclasses. #17909
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
* Add test for repr output of field and dataclass params. * Add test for ValueError to be raised when both default and default_factory are passed.
Lib/test/test_dataclasses.py
Outdated
| self.assertNotEqual(C(3), C(4, 10)) | ||
| self.assertNotEqual(C(3, 10), C(4, 10)) | ||
|
|
||
| def test_dataclass_params_repr(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.
This is testing an internal implementation detail. I'm not sure that this should be directly tested.
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 have no opinion about keeping the test or not. But if you want to keep it, add @cpython_only decorator.
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 have removed the test. I am not sure of a better way to access it publicly.
|
Thanks @tirkarthi for the PR, and @ericvsmith for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8. |
|
@ericvsmith: Please replace |
* Add test cases for dataclasses. * Add test for repr output of field. * Add test for ValueError to be raised when both default and default_factory are passed. (cherry picked from commit eef1b02) Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
|
GH-17919 is a backport of this pull request to the 3.8 branch. |
* Add test cases for dataclasses. * Add test for repr output of field. * Add test for ValueError to be raised when both default and default_factory are passed. (cherry picked from commit eef1b02) Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
|
GH-17920 is a backport of this pull request to the 3.7 branch. |
* Add test cases for dataclasses. * Add test for repr output of field. * Add test for ValueError to be raised when both default and default_factory are passed. (cherry picked from commit eef1b02) Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com> Automerge-Triggered-By: @ericvsmith
* Add test cases for dataclasses. * Add test for repr output of field. * Add test for ValueError to be raised when both default and default_factory are passed. (cherry picked from commit eef1b02) Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com> Automerge-Triggered-By: @ericvsmith
* Add test cases for dataclasses. * Add test for repr output of field. * Add test for ValueError to be raised when both default and default_factory are passed.
ValueErrorto be raised when both default and default_factory are passed to a field.Added missing coverage cases based on https://codecov.io/gh/python/cpython/src/2e6a8efa837410327b593dc83c57492253b1201e/Lib/dataclasses.py
Thanks