From 0ea039db602c01ddc57eac40b1abd60704a7d00c Mon Sep 17 00:00:00 2001 From: Yuval Shimon Date: Sun, 12 Dec 2021 16:11:33 +0200 Subject: [PATCH] adding auto_detect=true test --- testing/test_assertion.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/testing/test_assertion.py b/testing/test_assertion.py index fe5a3d3bb..8a4525cb7 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -1016,6 +1016,22 @@ class TestAssert_reprcompare_attrsclass: lines = callequal(left, right) assert lines is None + def test_attrs_with_auto_detect_and_custom_eq(self) -> None: + @attr.s( + auto_detect=True + ) # attr.s doesn’t ignore a custom eq if auto_detect=True + class SimpleDataObject: + field_a = attr.ib() + + def __eq__(self, other): # pragma: no cover + return super().__eq__(other) + + left = SimpleDataObject(1) + right = SimpleDataObject(2) + # issue 9362 + lines = callequal(left, right, verbose=2) + assert lines is None + def test_attrs_with_custom_eq(self) -> None: @attr.define class SimpleDataObject: