Skip to content

Commit 129a1cb

Browse files
committed
chore(tests[common]): pydocstyle manual fixes
1 parent 557dde2 commit 129a1cb

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

tests/test_common.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""Tests for utility functions in libtmux."""
2-
32
import re
43
import sys
54
import typing as t
@@ -29,6 +28,8 @@
2928

3029

3130
def test_allows_master_version(monkeypatch: pytest.MonkeyPatch) -> None:
31+
"""Assert get_version() works with builds from git trunk."""
32+
3233
class Hi:
3334
stdout: t.ClassVar = ["tmux master"]
3435
stderr = None
@@ -47,6 +48,7 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
4748

4849

4950
def test_allows_next_version(monkeypatch: pytest.MonkeyPatch) -> None:
51+
"""Assert get_version() supports next version."""
5052
TMUX_NEXT_VERSION = str(float(TMUX_MAX_VERSION) + 0.1)
5153

5254
class Hi:
@@ -65,6 +67,8 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
6567

6668

6769
def test_get_version_openbsd(monkeypatch: pytest.MonkeyPatch) -> None:
70+
"""Assert get_version() with OpenBSD versions."""
71+
6872
class Hi:
6973
stderr: t.ClassVar = ["tmux: unknown option -- V"]
7074

@@ -82,6 +86,8 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
8286

8387

8488
def test_get_version_too_low(monkeypatch: pytest.MonkeyPatch) -> None:
89+
"""Assert get_version() raises if tmux version too low."""
90+
8591
class Hi:
8692
stderr: t.ClassVar = ["tmux: unknown option -- V"]
8793

@@ -95,7 +101,7 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
95101

96102

97103
def test_ignores_letter_versions(monkeypatch: pytest.MonkeyPatch) -> None:
98-
"""Ignore letters such as 1.8b.
104+
"""Tests version utilities ignores letters such as 1.8b.
99105
100106
See ticket https://github.com/tmux-python/tmuxp/issues/55.
101107
@@ -118,6 +124,8 @@ def test_ignores_letter_versions(monkeypatch: pytest.MonkeyPatch) -> None:
118124

119125

120126
def test_error_version_less_1_7(monkeypatch: pytest.MonkeyPatch) -> None:
127+
"""Test raises if tmux version less than 1.7."""
128+
121129
def mock_get_version() -> LooseVersion:
122130
return LooseVersion("1.7")
123131

@@ -133,10 +141,12 @@ def mock_get_version() -> LooseVersion:
133141

134142

135143
def test_has_version() -> None:
144+
"""Test has_version()."""
136145
assert has_version(str(get_version()))
137146

138147

139148
def test_has_gt_version() -> None:
149+
"""Test has_gt_version()."""
140150
assert has_gt_version("1.6")
141151
assert has_gt_version("1.6b")
142152

@@ -145,6 +155,7 @@ def test_has_gt_version() -> None:
145155

146156

147157
def test_has_gte_version() -> None:
158+
"""Test has_gte_version()."""
148159
assert has_gte_version("1.6")
149160
assert has_gte_version("1.6b")
150161
assert has_gte_version(str(get_version()))
@@ -154,6 +165,7 @@ def test_has_gte_version() -> None:
154165

155166

156167
def test_has_lt_version() -> None:
168+
"""Test has_lt_version()."""
157169
assert has_lt_version("4.0a")
158170
assert has_lt_version("4.0")
159171

@@ -162,6 +174,7 @@ def test_has_lt_version() -> None:
162174

163175

164176
def test_has_lte_version() -> None:
177+
"""Test has_lti_version()."""
165178
assert has_lte_version("4.0a")
166179
assert has_lte_version("4.0")
167180
assert has_lte_version(str(get_version()))
@@ -171,16 +184,20 @@ def test_has_lte_version() -> None:
171184

172185

173186
def test_tmux_cmd_raises_on_not_found(monkeypatch: pytest.MonkeyPatch) -> None:
187+
"""Verify raises if tmux command not found."""
174188
monkeypatch.setenv("PATH", "")
175189
with pytest.raises(TmuxCommandNotFound):
176190
tmux_cmd("-V")
177191

178192

179193
def test_tmux_cmd_unicode(session: Session) -> None:
194+
"""Verify tmux commands with unicode."""
180195
session.cmd("new-window", "-t", 3, "-n", "юникод", "-F", "Ελληνικά")
181196

182197

183198
class SessionCheckName(t.NamedTuple):
199+
"""Test fixture for test_session_check_name()."""
200+
184201
session_name: t.Optional[str]
185202
raises: bool
186203
exc_msg_regex: t.Optional[str]
@@ -200,6 +217,7 @@ class SessionCheckName(t.NamedTuple):
200217
def test_session_check_name(
201218
session_name: t.Optional[str], raises: bool, exc_msg_regex: t.Optional[str]
202219
) -> None:
220+
"""Verify session_check_name()."""
203221
if raises:
204222
with pytest.raises(BadSessionName) as exc_info:
205223
session_check_name(session_name)
@@ -210,6 +228,7 @@ def test_session_check_name(
210228

211229

212230
def test_get_libtmux_version() -> None:
231+
"""Verify get_libtmux_version()."""
213232
from libtmux.__about__ import __version__
214233

215234
version = get_libtmux_version()

0 commit comments

Comments
 (0)