From 9705e9235c618fcb3bb4ddc01fa5bfaf72049b68 Mon Sep 17 00:00:00 2001 From: Phillip Schanely Date: Fri, 13 Dec 2024 15:13:02 -0500 Subject: [PATCH] Add an identity check to flexible_equal --- crosshair/test_util.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crosshair/test_util.py b/crosshair/test_util.py index 0b47b9ff..b99d7010 100644 --- a/crosshair/test_util.py +++ b/crosshair/test_util.py @@ -124,6 +124,8 @@ def check_messages(checkables: Iterable[Checkable], **kw) -> ComparableLists: def flexible_equal(a, b): + if a is b: + return True if type(a) is type(b) and type(a).__eq__ is object.__eq__: # If types match and it uses identity-equals, we can't do much. Assume equal. return True