@@ -27,6 +27,16 @@ class RandomStrSequence:
27
27
def __init__ (
28
28
self , characters : str = "abcdefghijklmnopqrstuvwxyz0123456789_"
29
29
) -> 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
+ """
30
40
self .characters : str = characters
31
41
32
42
def __iter__ (self ) -> "RandomStrSequence" :
@@ -110,6 +120,15 @@ def get_test_session_name(server: "Server", prefix: str = TEST_SESSION_PREFIX) -
110
120
-------
111
121
str
112
122
Random session name guaranteed to not collide with current ones.
123
+
124
+ Examples
125
+ --------
126
+ >>> get_test_session_name(server=server)
127
+ 'libtmux_...'
128
+
129
+ Never the same twice:
130
+ >>> get_test_session_name(server=server) != get_test_session_name(server=server)
131
+ True
113
132
"""
114
133
while True :
115
134
session_name = prefix + next (namer )
@@ -138,6 +157,15 @@ def get_test_window_name(
138
157
-------
139
158
str
140
159
Random window name guaranteed to not collide with current ones.
160
+
161
+ Examples
162
+ --------
163
+ >>> get_test_window_name(session=session)
164
+ 'libtmux_...'
165
+
166
+ Never the same twice:
167
+ >>> get_test_window_name(session=session) != get_test_window_name(session=session)
168
+ True
141
169
"""
142
170
assert prefix is not None
143
171
while True :
@@ -181,7 +209,7 @@ def temp_session(
181
209
182
210
>>> with temp_session(server) as session:
183
211
... session.new_window(window_name='my window')
184
- Window(@... ...:... , Session($... ...))
212
+ Window(@3 2:my window , Session($... ...))
185
213
"""
186
214
187
215
if "session_name" in kwargs :
@@ -233,12 +261,12 @@ def temp_window(
233
261
234
262
>>> with temp_window(session) as window:
235
263
... window
236
- Window(@... ... :..., Session($... ...))
264
+ Window(@2 2 :... Session($1 libtmux_ ...))
237
265
238
266
239
267
>>> with temp_window(session) as window:
240
268
... window.split_window()
241
- Pane(%... Window(@... ...: ..., Session($... ...)))
269
+ Pane(%4 Window(@3 2:libtmux_ ..., Session($1 libtmux_ ...)))
242
270
"""
243
271
244
272
if "window_name" not in kwargs :
@@ -270,7 +298,6 @@ class EnvironmentVarGuard:
270
298
271
299
Notes
272
300
-----
273
-
274
301
Vendorized to fix issue with Anaconda Python 2 not including test module,
275
302
see #121 [1]_
276
303
0 commit comments