|
8 | 8 |
|
9 | 9 | from libtmux import exc |
10 | 10 | from libtmux.common import has_gte_version, has_lt_version, has_version |
| 11 | +from libtmux.constants import OptionScope |
11 | 12 | from libtmux.pane import Pane |
12 | 13 | from libtmux.server import Server |
13 | 14 | from libtmux.session import Session |
@@ -284,18 +285,37 @@ def test_set_and_show_options(session: Session) -> None: |
284 | 285 | window = session.new_window(window_name="test_window") |
285 | 286 |
|
286 | 287 | window.set_option("main-pane-height", 20) |
287 | | - assert window._show_option("main-pane-height") == 20 |
| 288 | + if has_gte_version("3.0"): |
| 289 | + assert window._show_option("main-pane-height") == 20 |
| 290 | + else: |
| 291 | + assert window._show_option("main-pane-height", scope=OptionScope.Window) == 20 |
288 | 292 |
|
289 | 293 | window.set_option("main-pane-height", 40) |
290 | | - assert window._show_option("main-pane-height") == 40 |
| 294 | + |
| 295 | + if has_gte_version("3.0"): |
| 296 | + assert window._show_option("main-pane-height") == 40 |
| 297 | + else: |
| 298 | + assert window._show_option("main-pane-height", scope=OptionScope.Window) == 40 |
291 | 299 |
|
292 | 300 | # By default, show-options will session scope, even if target is a window |
293 | 301 | with pytest.raises(KeyError): |
294 | 302 | assert window._show_options()["main-pane-height"] == 40 |
295 | 303 |
|
| 304 | + if has_gte_version("3.0"): |
| 305 | + assert window._show_option("main-pane-height") == 40 |
| 306 | + else: |
| 307 | + assert window._show_option("main-pane-height", scope=OptionScope.Window) == 40 |
| 308 | + |
296 | 309 | if has_gte_version("2.3"): |
297 | 310 | window.set_option("pane-border-format", " #P ") |
298 | | - assert window._show_option("pane-border-format") == " #P " |
| 311 | + |
| 312 | + if has_gte_version("3.0"): |
| 313 | + assert window._show_option("pane-border-format") == " #P " |
| 314 | + else: |
| 315 | + assert ( |
| 316 | + window._show_option("pane-border-format", scope=OptionScope.Window) |
| 317 | + == " #P " |
| 318 | + ) |
299 | 319 |
|
300 | 320 |
|
301 | 321 | def test_empty_window_option_returns_None(session: Session) -> None: |
|
0 commit comments