Skip to content

Commit 5faa80d

Browse files
committed
tests(handle_error_message): Add doctests
1 parent 583ae91 commit 5faa80d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/libtmux/options.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,22 @@ def handle_option_error(error: str) -> t.Type[exc.OptionError]:
148148
------
149149
:exc:`exc.OptionError`, :exc:`exc.UnknownOption`, :exc:`exc.InvalidOption`,
150150
:exc:`exc.AmbiguousOption`
151+
152+
Examples
153+
--------
154+
>>> result = server.cmd(
155+
... 'set-option',
156+
... 'unknown-option-name',
157+
... )
158+
159+
>>> bool(isinstance(result.stderr, list) and len(result.stderr))
160+
True
161+
162+
>>> import pytest
163+
>>> from libtmux import exc
164+
165+
>>> with pytest.raises(exc.OptionError):
166+
... handle_option_error(result.stderr[0])
151167
"""
152168
if "unknown option" in error:
153169
raise exc.UnknownOption(error)

0 commit comments

Comments
 (0)