Skip to content

Commit a254123

Browse files
committed
tests update for tests_pane
1 parent e4a5a3a commit a254123

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

src/libtmux/pane.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212
import typing as t
1313
from typing import overload
1414

15-
from libtmux.common import tmux_cmd
16-
1715
import libtmux
16+
from libtmux.common import tmux_cmd
1817

1918
from . import exc
20-
from .common import PaneDict, TmuxMappingObject, TmuxRelationalObject
19+
from .common import PaneDict, TmuxMappingObject
2120

2221
if t.TYPE_CHECKING:
2322
from typing_extensions import Literal
@@ -31,11 +30,9 @@
3130

3231
__all__ = ["Pane"]
3332

34-
# class Pane(TmuxMappingObject, TmuxRelationalObject):
35-
3633

3734
@dataclasses.dataclass
38-
class Pane(TmuxMappingObject, TmuxRelationalObject):
35+
class Pane(TmuxMappingObject):
3936
"""
4037
A :term:`tmux(1)` :term:`Pane` [pane_manual]_.
4138
@@ -119,12 +116,12 @@ class Pane(TmuxMappingObject, TmuxRelationalObject):
119116
session: "libtmux.session.Session" = dataclasses.field(init=False)
120117
server: "libtmux.server.Server" = dataclasses.field(init=False)
121118
window_name: str = dataclasses.field(init=True, default="")
122-
pane_start_command: Optional[str] = dataclasses.field(init=True, default=None)
119+
pane_start_command: t.Optional[str] = dataclasses.field(init=True, default=None)
123120

124121
formatter_prefix = "pane_"
125122
"""Namespace used for :class:`~libtmux.common.TmuxMappingObject`"""
126123

127-
def __post_init__(self, **kwargs):
124+
def __post_init__(self, **kwargs: t.Any) -> None:
128125
# if not window:
129126
# raise ValueError("Pane must have ``Window`` object")
130127
#
@@ -144,7 +141,7 @@ def __post_init__(self, **kwargs):
144141

145142
self.server._update_panes()
146143

147-
def refresh(self):
144+
def refresh(self) -> None:
148145
try:
149146
info = self._info
150147
except IndexError:

tests/test_pane.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ def test_resize_pane(session: Session) -> None:
1414

1515
pane1 = window.attached_pane
1616
assert pane1 is not None
17-
pane1_height = pane1["pane_height"]
17+
pane1_height = pane1.pane_height
1818
window.split_window()
1919

2020
pane1.resize_pane(height=4)
21-
assert pane1["pane_height"] != pane1_height
22-
assert int(pane1["pane_height"]) == 4
21+
assert pane1.pane_height != pane1_height
22+
assert int(pane1.pane_height) == 4
2323

2424
pane1.resize_pane(height=3)
25-
assert int(pane1["pane_height"]) == 3
25+
assert int(pane1.pane_height) == 3
2626

2727

2828
def test_send_keys(session: Session) -> None:
@@ -42,11 +42,11 @@ def test_set_height(session: Session) -> None:
4242
window.split_window()
4343
pane1 = window.attached_pane
4444
assert pane1 is not None
45-
pane1_height = pane1["pane_height"]
45+
pane1_height = pane1.pane_height
4646

4747
pane1.set_height(4)
48-
assert pane1["pane_height"] != pane1_height
49-
assert int(pane1["pane_height"]) == 4
48+
assert pane1.pane_height != pane1_height
49+
assert int(pane1.pane_height) == 4
5050

5151

5252
def test_set_width(session: Session) -> None:
@@ -56,11 +56,11 @@ def test_set_width(session: Session) -> None:
5656
window.select_layout("main-vertical")
5757
pane1 = window.attached_pane
5858
assert pane1 is not None
59-
pane1_width = pane1["pane_width"]
59+
pane1_width = pane1.pane_width
6060

6161
pane1.set_width(10)
62-
assert pane1["pane_width"] != pane1_width
63-
assert int(pane1["pane_width"]) == 10
62+
assert pane1.pane_width != pane1_width
63+
assert int(pane1.pane_width) == 10
6464

6565
pane1.reset()
6666

0 commit comments

Comments
 (0)