Skip to content

Commit f2b0d40

Browse files
committed
tests/test_window.py(refactor): Simplify version conditionals
why: tmux >= 3.2a now required, has_gte_version checks always true what: - Remove has_gte_version("3.0") conditionals in test_set_and_show_window_options - Remove has_gte_version("2.3") conditional - Keep only the tmux 3.0+ code paths
1 parent cd2d14a commit f2b0d40

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

tests/test_window.py

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -310,37 +310,19 @@ def test_set_and_show_window_options(session: Session) -> None:
310310
window = session.new_window(window_name="test_window")
311311

312312
window.set_option("main-pane-height", 20)
313-
if has_gte_version("3.0"):
314-
assert window._show_option("main-pane-height") == 20
315-
else:
316-
assert window._show_option("main-pane-height", scope=OptionScope.Window) == 20
313+
assert window._show_option("main-pane-height") == 20
317314

318315
window.set_option("main-pane-height", 40)
319-
320-
if has_gte_version("3.0"):
321-
assert window._show_option("main-pane-height") == 40
322-
else:
323-
assert window._show_option("main-pane-height", scope=OptionScope.Window) == 40
316+
assert window._show_option("main-pane-height") == 40
324317

325318
# By default, show-options will session scope, even if target is a window
326319
with pytest.raises(KeyError):
327320
assert window._show_options(scope=OptionScope.Session)["main-pane-height"] == 40
328321

329-
if has_gte_version("3.0"):
330-
assert window._show_option("main-pane-height") == 40
331-
else:
332-
assert window._show_option("main-pane-height", scope=OptionScope.Window) == 40
333-
334-
if has_gte_version("2.3"):
335-
window.set_option("pane-border-format", " #P ")
336-
337-
if has_gte_version("3.0"):
338-
assert window._show_option("pane-border-format") == " #P "
339-
else:
340-
assert (
341-
window._show_option("pane-border-format", scope=OptionScope.Window)
342-
== " #P "
343-
)
322+
assert window._show_option("main-pane-height") == 40
323+
324+
window.set_option("pane-border-format", " #P ")
325+
assert window._show_option("pane-border-format") == " #P "
344326

345327

346328
def test_empty_window_option_returns_None(session: Session) -> None:

0 commit comments

Comments
 (0)