Skip to content

Commit 1476875

Browse files
committed
fix(test): Fix doctest examples in random.py
why: The doctest examples were using line continuation with backslash followed by ellipsis which caused syntax errors during doctest execution. what: Replace multiline examples with simpler single-line assertions and use intermediate variables to make the examples more readable
1 parent a1ee582 commit 1476875

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/libtmux/test/random.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ def get_test_session_name(server: Server, prefix: str = TEST_SESSION_PREFIX) ->
7979
'libtmux_...'
8080
8181
Never the same twice:
82-
>>> get_test_session_name(server=server) != \
83-
... get_test_session_name(server=server) # pragma: no cover
82+
>>> name1 = get_test_session_name(server=server) # pragma: no cover
83+
>>> name2 = get_test_session_name(server=server) # pragma: no cover
84+
>>> name1 != name2 # pragma: no cover
8485
True
8586
"""
8687
while True:
@@ -118,9 +119,9 @@ def get_test_window_name(
118119
'libtmux_...'
119120
120121
Never the same twice:
121-
122-
>>> get_test_window_name(session=session) != \
123-
... get_test_window_name(session=session) # pragma: no cover
122+
>>> name1 = get_test_window_name(session=session) # pragma: no cover
123+
>>> name2 = get_test_window_name(session=session) # pragma: no cover
124+
>>> name1 != name2 # pragma: no cover
124125
True
125126
"""
126127
assert prefix is not None

tests/test/test_environment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def test_environment_var_guard_exit_with_exception() -> None:
121121

122122
# Call __exit__ with exception parameters
123123
env.__exit__(
124-
t.cast(type[BaseException], RuntimeError),
124+
t.cast("type[BaseException]", RuntimeError),
125125
RuntimeError("Test exception"),
126126
None,
127127
)

0 commit comments

Comments
 (0)