Skip to content

Commit b59e579

Browse files
committed
tests(doctests): Window example and rename_window
1 parent f5cbede commit b59e579

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

libtmux/window.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,32 @@ class Window(TmuxMappingObject, TmuxRelationalObject["Pane", "PaneDict"]):
3939
----------
4040
session : :class:`Session`
4141
42+
Examples
43+
--------
44+
>>> window = session.new_window('My project')
45+
46+
>>> window
47+
Window(@... ...:My project, Session($... ...))
48+
49+
Windows have panes:
50+
51+
>>> window.panes
52+
[Pane(...)]
53+
54+
>>> window.attached_pane
55+
Pane(...)
56+
57+
Relations moving up:
58+
59+
>>> window.session
60+
Session(...)
61+
62+
>>> window == session.attached_window
63+
True
64+
65+
>>> window in session.windows
66+
True
67+
4268
References
4369
----------
4470
.. [window_manual] tmux window. openbsd manpage for TMUX(1).
@@ -303,10 +329,10 @@ def rename_window(self, new_name: str) -> "Window":
303329
>>> window = session.attached_window
304330
305331
>>> window.rename_window('My project')
306-
Window(@1 1:My project, Session($1 ...))
332+
Window(@1 ...:My project, Session($1 ...))
307333
308334
>>> window.rename_window('New name')
309-
Window(@1 1:New name, Session($1 ...))
335+
Window(@1 ...:New name, Session($1 ...))
310336
"""
311337

312338
import shlex

0 commit comments

Comments
 (0)