From e320b87ab094edd8534ad32d29d9f6506edc899a Mon Sep 17 00:00:00 2001 From: Miguel Perez Date: Mon, 23 Oct 2023 10:33:12 +0200 Subject: [PATCH 1/3] Fixed __eq__ for windows. --- src/libtmux/window.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libtmux/window.py b/src/libtmux/window.py index dd1c49706..7fc155ac8 100644 --- a/src/libtmux/window.py +++ b/src/libtmux/window.py @@ -552,7 +552,8 @@ def attached_pane(self) -> t.Optional["Pane"]: # Dunder # def __eq__(self, other: object) -> bool: - assert isinstance(other, Window) + if not isinstance(other, Window): + return False return self.window_id == other.window_id def __repr__(self) -> str: From 2897712cb2d37030a7fbf106192df649966ba823 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 25 Nov 2023 12:16:52 -0600 Subject: [PATCH 2/3] chore(window.__eq__): Flip conditions --- src/libtmux/window.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libtmux/window.py b/src/libtmux/window.py index 7fc155ac8..d52b00f2a 100644 --- a/src/libtmux/window.py +++ b/src/libtmux/window.py @@ -552,9 +552,9 @@ def attached_pane(self) -> t.Optional["Pane"]: # Dunder # def __eq__(self, other: object) -> bool: - if not isinstance(other, Window): - return False - return self.window_id == other.window_id + if isinstance(other, Window): + return self.window_id == other.window_id + return False def __repr__(self) -> str: return "{}({} {}:{}, {})".format( From bdb105f344fee48d7064cee69d84d3c819d60eb5 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 25 Nov 2023 13:05:57 -0600 Subject: [PATCH 3/3] docs(CHANGES): Note `__eq__` improvement --- CHANGES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index 88d130341..d29d70467 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,11 @@ $ pip install --user --upgrade --pre libtmux +### Improvement + +- `Window.__eq__` now returns `False` instead of raising `AssertionError`, thank + you @m1guelperez! (#505) + ## libtmux 0.24.1 (2023-11-23) ### Packaging