@@ -27,6 +27,16 @@ class RandomStrSequence:
2727 def __init__ (
2828 self , characters : str = "abcdefghijklmnopqrstuvwxyz0123456789_"
2929 ) -> None :
30+ """Create a random letter / number generator. 8 chars in length.
31+
32+ >>> rng = RandomStrSequence()
33+ >>> next(rng)
34+ '...'
35+ >>> len(next(rng))
36+ 8
37+ >>> type(next(rng))
38+ <class 'str'>
39+ """
3040 self .characters : str = characters
3141
3242 def __iter__ (self ) -> "RandomStrSequence" :
@@ -68,7 +78,6 @@ def retry_until(
6878
6979 Examples
7080 --------
71-
7281 >>> def fn():
7382 ... p = session.attached_window.attached_pane
7483 ... p.server._update_panes()
@@ -110,6 +119,15 @@ def get_test_session_name(server: "Server", prefix: str = TEST_SESSION_PREFIX) -
110119 -------
111120 str
112121 Random session name guaranteed to not collide with current ones.
122+
123+ Examples
124+ --------
125+ >>> get_test_session_name(server=server)
126+ 'libtmux_...'
127+
128+ Never the same twice:
129+ >>> get_test_session_name(server=server) != get_test_session_name(server=server)
130+ True
113131 """
114132 while True :
115133 session_name = prefix + next (namer )
@@ -138,6 +156,15 @@ def get_test_window_name(
138156 -------
139157 str
140158 Random window name guaranteed to not collide with current ones.
159+
160+ Examples
161+ --------
162+ >>> get_test_window_name(session=session)
163+ 'libtmux_...'
164+
165+ Never the same twice:
166+ >>> get_test_window_name(session=session) != get_test_window_name(session=session)
167+ True
141168 """
142169 assert prefix is not None
143170 while True :
@@ -178,10 +205,9 @@ def temp_session(
178205
179206 Examples
180207 --------
181-
182208 >>> with temp_session(server) as session:
183209 ... session.new_window(window_name='my window')
184- Window(@... ...:... , Session($... ...))
210+ Window(@3 2:my window , Session($... ...))
185211 """
186212
187213 if "session_name" in kwargs :
@@ -230,17 +256,15 @@ def temp_window(
230256
231257 Examples
232258 --------
233-
234259 >>> with temp_window(session) as window:
235260 ... window
236- Window(@... ... :..., Session($... ...))
261+ Window(@2 2 :... Session($1 libtmux_ ...))
237262
238263
239264 >>> with temp_window(session) as window:
240265 ... window.split_window()
241- Pane(%... Window(@... ...: ..., Session($... ...)))
266+ Pane(%4 Window(@3 2:libtmux_ ..., Session($1 libtmux_ ...)))
242267 """
243-
244268 if "window_name" not in kwargs :
245269 window_name = get_test_window_name (session )
246270 else :
@@ -262,21 +286,18 @@ def temp_window(
262286
263287
264288class EnvironmentVarGuard :
265-
266289 """Mock environmental variables safetly.
267290
268291 Helps rotect the environment variable properly. Can be used as context
269292 manager.
270293
271294 Notes
272295 -----
273-
274296 Vendorized to fix issue with Anaconda Python 2 not including test module,
275297 see #121 [1]_
276298
277299 References
278300 ----------
279-
280301 .. [1] Just installed, "ImportError: cannot import name test_support".
281302 GitHub issue for tmuxp. https://github.com/tmux-python/tmuxp/issues/121.
282303 Created October 12th, 2015. Accessed April 7th, 2018.
0 commit comments