hynek / characteristic

Please use attrs instead!
https://attrs.readthedocs.io/
MIT License
84 stars 19 forks source link

Add a testing helper which verifies the equality/hashing behavior supplied by `with_cmp` #4

Open exarkun opened 10 years ago

exarkun commented 10 years ago

One wants to unit test this sort of behavior but characteristic has enough information to automatically generate these tests in most cases.

Perhaps something like MyClassEqualityTests = make_equality_tests(MyClass)?

hynek commented 10 years ago

That sounds great, pull request (for all three cases) maybe? :)

wallrj commented 10 years ago

Twisted has testutils.ComparisonTestsMixin.assertNormalEqualityImplementation https://github.com/twisted/twisted/blob/trunk/twisted/test/testutils.py#L125

With all that in mind, has anyone got any hints on the best way to implement this?

hynek commented 10 years ago

Removing milestone. Feel free to submit a pull request once you’ve settled on an approach.