Skip to content

Remove assert from __eq__ for windows #504

Closed
@m1guelperez

Description

@m1guelperez
for window in session.list_windows():
    if window.name == "test_window":
        target_window = window
        break
    if target_window == None:
        target_window = session.new_window(attach=True, window_name="test_window")
    target_window.select_window()
    target_window.panes[0].send_keys("exec zsh")

The code above will crash, when the window exists and we then check the if target_window == None because of:

def __eq__(self, other: object) -> bool:
    assert isinstance(other, Window)
    return self.window_id == other.window_id

I guess it would be better to remove the assert and return false. Should I do a PR?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions