def test_window_only(mocker, monkeypatch): """Verify that window_only doesn't close the current or deleted windows.""" test_windows = {0: FakeWindow(), 1: FakeWindow(True), 2: FakeWindow()} winreg_mock = mocker.patch('qutebrowser.misc.utilcmds.objreg') winreg_mock.window_registry = test_windows sip_mock = mocker.patch('qutebrowser.misc.utilcmds.sip') sip_mock.isdeleted.side_effect = lambda window: window.deleted utilcmds.window_only(current_win_id=0) assert not test_windows[0].closed assert not test_windows[1].closed assert test_windows[2].closed