Skip to content

Commit 838fe1f

Browse files
committed
add doc and small code cleaning
1 parent b40cb45 commit 838fe1f

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

plotpy/tests/unit/test_cursor_tools.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
from typing import TYPE_CHECKING
4+
35
import numpy as np
46
import pytest
57
from guidata.qthelpers import exec_dialog, qt_app_context
@@ -14,15 +16,21 @@
1416
VCursorTool,
1517
XCursorTool,
1618
)
17-
from plotpy.tools.cursor import BaseCursorTool
1819

19-
# guitest: show
20+
if TYPE_CHECKING:
21+
from plotpy.tools.cursor import BaseCursorTool
2022

2123

2224
@pytest.mark.parametrize(
2325
"cursor_tool", [HCursorTool, VCursorTool, XCursorTool, HRangeTool]
2426
)
2527
def test_cursor_tool(cursor_tool: type[BaseCursorTool]):
28+
"""Test the cursor tools. by simulating a mouse drag and checking if the tool
29+
shape is created.
30+
31+
Args:
32+
cursor_tool: Cursor tool class to test.
33+
"""
2634
with qt_app_context(exec_loop=True) as qapp:
2735
win, tool = create_window(cursor_tool)
2836
win.show()
@@ -40,7 +48,5 @@ def test_cursor_tool(cursor_tool: type[BaseCursorTool]):
4048

4149

4250
if __name__ == "__main__":
43-
test_cursor_tool(HCursorTool)
44-
test_cursor_tool(VCursorTool)
45-
test_cursor_tool(XCursorTool)
46-
test_cursor_tool(HRangeTool)
51+
for tool in (HCursorTool, VCursorTool, XCursorTool, HRangeTool):
52+
test_cursor_tool(tool)

0 commit comments

Comments
 (0)