Skip to content

Commit

Permalink
Fix auto-detection of eq/ne in NG APIs (#671)
Browse files Browse the repository at this point in the history
Fixes #670
  • Loading branch information
hynek committed Aug 21, 2020
1 parent 1a29941 commit 358c85e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
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()

0 comments on commit 358c85e

Please sign in to comment.