Skip to content

Commit 0ea039d

Browse files
author
Yuval Shimon
committed
adding auto_detect=true test
1 parent 0c45065 commit 0ea039d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

testing/test_assertion.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,22 @@ class SimpleDataObjectTwo:
10161016
lines = callequal(left, right)
10171017
assert lines is None
10181018

1019+
def test_attrs_with_auto_detect_and_custom_eq(self) -> None:
1020+
@attr.s(
1021+
auto_detect=True
1022+
) # attr.s doesn’t ignore a custom eq if auto_detect=True
1023+
class SimpleDataObject:
1024+
field_a = attr.ib()
1025+
1026+
def __eq__(self, other): # pragma: no cover
1027+
return super().__eq__(other)
1028+
1029+
left = SimpleDataObject(1)
1030+
right = SimpleDataObject(2)
1031+
# issue 9362
1032+
lines = callequal(left, right, verbose=2)
1033+
assert lines is None
1034+
10191035
def test_attrs_with_custom_eq(self) -> None:
10201036
@attr.define
10211037
class SimpleDataObject:

0 commit comments

Comments
 (0)