Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_attached_pane(session):
"""Session.attached_pane returns Pane."""
assert isinstance(session.attached_pane, Pane)
get_by_id = session.get_by_id(window_id)
assert get_by_id == window
assert isinstance(get_by_id, Window)
assert session.get_by_id('@' + next(namer)) is None
# window.get_by_id
for pane in window.panes:
pane_id = pane.get('pane_id')
get_by_id = window.get_by_id(pane_id)
assert get_by_id == pane
assert isinstance(get_by_id, Pane)
assert window.get_by_id('%' + next(namer)) is None
assert server.find_where({'session_id': session_id}) == session
assert isinstance(server.find_where({'session_id': session_id}), Session)
# session.find_where
for window in session.windows:
window_id = window.get('window_id')
assert session.find_where({'window_id': window_id}) == window
assert isinstance(session.find_where({'window_id': window_id}), Window)
# window.find_where
for pane in window.panes:
pane_id = pane.get('pane_id')
assert window.find_where({'pane_id': pane_id}) == pane
assert isinstance(window.find_where({'pane_id': pane_id}), Pane)
assert find_where == window
assert isinstance(find_where, Window)
# window.findWhere
for pane in window.panes:
pane_id = pane.get('pane_id')
pane_tty = pane.get('pane_tty')
find_where = window.findWhere({
'pane_id': pane_id,
'pane_tty': pane_tty
})
assert find_where == pane
assert isinstance(find_where, Pane)
def test_split_window_shell(session):
"""Window.split_window() splits window, returns new Pane, vertical."""
window_name = 'test split window'
cmd = 'sleep 1m'
window = session.new_window(window_name=window_name, attach=True)
pane = window.split_window(shell=cmd)
assert len(window.panes) == 2
assert isinstance(pane, Pane)
assert float(window.panes[0].height) <= ((float(window.width) + 1) / 2)
assert pane.get('pane_start_command') == cmd
def test_attached_pane(session):
"""Session.attached_pane() returns Pane."""
assert isinstance(session.attached_pane(), Pane)
def test_split_window(session):
"""Window.split_window() splits window, returns new Pane."""
window_name = 'test split window'
window = session.new_window(window_name=window_name, attach=True)
pane = window.split_window()
assert len(window.panes) == 2
assert isinstance(pane, Pane)
def test_attached_pane(session):
"""Window.attached_window returns active Pane."""
window = session.attached_window # current window
assert isinstance(window.attached_pane, Pane)
def test_attached_pane(session):
"""Window.attached_window() returns active Pane."""
window = session.attached_window() # current window
assert isinstance(window.attached_pane(), Pane)
# session.findWhere
for window in session.windows:
window_id = window.get('window_id')
assert session.findWhere({'window_id': window_id}) == window
assert isinstance(
session.findWhere({'window_id': window_id}), Window
)
# window.findWhere
for pane in window.panes:
pane_id = pane.get('pane_id')
assert window.findWhere({'pane_id': pane_id}) == pane
assert isinstance(
window.findWhere({'pane_id': pane_id}), Pane)