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

Fix auto-detection of eq/ne in NG APIs #671

Merged
merged 1 commit into from Aug 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/attr/_next_gen.py
Expand Up @@ -28,7 +28,7 @@ def define(
kw_only=False,
cache_hash=False,
auto_exc=True,
eq=True,
eq=None,
order=False,
auto_detect=True,
getstate_setstate=None,
Expand Down
15 changes: 15 additions & 0 deletions tests/test_next_gen.py
Expand Up @@ -133,3 +133,18 @@ class F:

with pytest.raises(attr.exceptions.FrozenInstanceError):
f.x = 2

def test_auto_detect_eq(self):
"""
auto_detect=True works for eq.

Regression test for #670.
"""

@attr.define
class C:
def __eq__(self, o):
raise ValueError()

with pytest.raises(ValueError):
C() == C()