Skip to content

Commit 797b057

Browse files
committed
!squash waiter.py
1 parent b97ad7c commit 797b057

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

src/libtmux/test/waiter.py

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -89,29 +89,30 @@ class PaneContentWaiter:
8989
9090
Examples
9191
--------
92-
```python
93-
# Basic usage
94-
result = PaneContentWaiter(pane).wait_for_text("hello world")
95-
96-
# With options
97-
result = (
98-
PaneContentWaiter(pane)
99-
.with_timeout(10.0)
100-
.wait_for_exact_text("completed successfully")
101-
)
92+
.. code-block:: python
10293
103-
# Wait for regex pattern
104-
result = (
105-
PaneContentWaiter(pane)
106-
.with_timeout(10.0)
107-
.wait_for_regex(r"Process \d+ completed")
108-
)
94+
# Basic usage
95+
result = PaneContentWaiter(pane).wait_for_text("hello world")
96+
97+
# With options
98+
result = (
99+
PaneContentWaiter(pane)
100+
.with_timeout(10.0)
101+
.wait_for_exact_text("completed successfully")
102+
)
103+
104+
# Wait for regex pattern
105+
result = (
106+
PaneContentWaiter(pane)
107+
.with_timeout(10.0)
108+
.wait_for_regex(r"Process \d+ completed")
109+
)
109110
110-
# Custom predicate
111-
def is_ready(content):
112-
return any("ready" in line.lower() for line in content)
111+
# Custom predicate
112+
def is_ready(content):
113+
return any("ready" in line.lower() for line in content)
113114
114-
result = PaneContentWaiter(pane).wait_for_predicate(is_ready)
115+
result = PaneContentWaiter(pane).wait_for_predicate(is_ready)
115116
"""
116117

117118
def __init__(self, pane: Pane) -> None:
@@ -324,20 +325,21 @@ def expect(pane: Pane) -> PaneContentWaiter:
324325
325326
Examples
326327
--------
327-
```python
328-
# Wait for text with a longer timeout
329-
result = (
330-
expect(pane)
331-
.with_timeout(10.0)
332-
.wait_for_text("Operation completed")
333-
)
328+
.. code-block:: python
334329
335-
# Wait for a regex match without raising exceptions on timeout
336-
result = (
337-
expect(pane)
338-
.without_raising()
339-
.wait_for_regex(r"Process \d+ completed")
340-
)
330+
# Wait for text with a longer timeout
331+
result = (
332+
expect(pane)
333+
.with_timeout(10.0)
334+
.wait_for_text("Operation completed")
335+
)
336+
337+
# Wait for a regex match without raising exceptions on timeout
338+
result = (
339+
expect(pane)
340+
.without_raising()
341+
.wait_for_regex(r"Process \d+ completed")
342+
)
341343
"""
342344
return PaneContentWaiter(pane)
343345

0 commit comments

Comments
 (0)