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

Fixes #670
This commit is contained in:
Hynek Schlawack 2020-08-21 05:19:15 +02:00 committed by GitHub
parent 1a29941d5c
commit 358c85e74c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -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,

View File

@ -133,3 +133,18 @@ class TestNextGen:
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()