3131
3232def test_curve_stat_tool ():
3333 """Test the curve stats tool."""
34- with qt_app_context (exec_loop = False ) as qapp :
35- win , tool = create_window (CurveStatsTool )
34+ with qt_app_context (exec_loop = False ):
35+ win , _tool = create_window (CurveStatsTool )
3636 win .show ()
3737 plot = win .manager .get_plot ()
3838
@@ -42,7 +42,7 @@ def test_curve_stat_tool():
4242 if isinstance (item , (DataInfoLabel , XRangeSelection ))
4343 ]
4444
45- drag_mouse (win , qapp , np .array ([0.4 , 0.6 ]), np .array ([0.5 , 0.5 ]))
45+ drag_mouse (win , np .array ([0.4 , 0.6 ]), np .array ([0.5 , 0.5 ]))
4646
4747 new_stat_items = [
4848 item
@@ -58,15 +58,15 @@ def test_curve_stat_tool():
5858 win .manager .add_tool (SelectTool ).activate ()
5959 plot .unselect_all ()
6060
61- mouse_event_at_relative_plot_pos (win , qapp , (0.5 , 0.5 ), CLICK )
61+ mouse_event_at_relative_plot_pos (win , (0.5 , 0.5 ), CLICK )
6262 selected_items = plot .get_selected_items ()
6363 assert len (selected_items ) == 1 and isinstance (
6464 selected_items [0 ], XRangeSelection
6565 )
6666 range_item : XRangeSelection = selected_items [0 ]
6767
6868 x00 , x01 , y0 = range_item .get_handles_pos ()
69- drag_mouse (win , qapp , np .linspace (0.5 , 0.9 , 100 ), np .full (100 , 0.5 ))
69+ drag_mouse (win , np .linspace (0.5 , 0.9 , 100 ), np .full (100 , 0.5 ))
7070 x10 , x11 , y1 = range_item .get_handles_pos ()
7171
7272 assert x00 < x10 and x01 < x11 and y0 == y1
@@ -84,32 +84,22 @@ def test_curve_stat_tool():
8484
8585def test_free_select_point_tool ():
8686 """Test the free select point tool."""
87- with qt_app_context (exec_loop = False ) as qapp :
87+ with qt_app_context (exec_loop = False ):
8888 win , tool = create_window (SelectPointTool )
8989 win .show ()
90- mouse_event_at_relative_plot_pos (
91- win ,
92- qapp ,
93- (0.5 , 0.5 ),
94- CLICK ,
95- )
90+ mouse_event_at_relative_plot_pos (win , (0.5 , 0.5 ), CLICK )
9691 assert tool .get_coordinates () is not None
9792 exec_dialog (win )
9893
9994
10095def test_contrained_select_point_tool ():
10196 """Test the constrained select point tool contrained to a CurveItem."""
102- with qt_app_context (exec_loop = False ) as qapp :
97+ with qt_app_context (exec_loop = False ):
10398 win , tool = create_window (SelectPointTool )
10499 win .show ()
105100 tool .on_active_item = True
106101
107- mouse_event_at_relative_plot_pos (
108- win ,
109- qapp ,
110- (0.5 , 0.5 ),
111- CLICK ,
112- )
102+ mouse_event_at_relative_plot_pos (win , (0.5 , 0.5 ), CLICK )
113103 coor = tool .get_coordinates ()
114104 curve_item : CurveItem = win .manager .get_plot ().get_active_item () # type: ignore
115105 arr_x , arr_y = curve_item .get_data ()
@@ -122,25 +112,25 @@ def test_contrained_select_point_tool():
122112
123113def test_select_points_tool ():
124114 """Test the select points tool constrained to a CurveItem."""
125- with qt_app_context (exec_loop = False ) as qapp :
115+ with qt_app_context (exec_loop = False ):
126116 win , tool = create_window (tool_class = SelectPointsTool )
127117 mod = QC .Qt .KeyboardModifier .ControlModifier
128118
129- mouse_event_at_relative_plot_pos (win , qapp , (0.4 , 0.5 ), CLICK , mod )
119+ mouse_event_at_relative_plot_pos (win , (0.4 , 0.5 ), CLICK , mod )
130120 assert len (tool .get_coordinates () or ()) == 1
131121
132- mouse_event_at_relative_plot_pos (win , qapp , (0.5 , 0.5 ), CLICK , mod )
133- mouse_event_at_relative_plot_pos (win , qapp , (0.8 , 0.8 ), CLICK , mod )
122+ mouse_event_at_relative_plot_pos (win , (0.5 , 0.5 ), CLICK , mod )
123+ mouse_event_at_relative_plot_pos (win , (0.8 , 0.8 ), CLICK , mod )
134124 print (tool .get_coordinates ())
135125 assert len (tool .get_coordinates () or ()) == 3
136126
137- mouse_event_at_relative_plot_pos (win , qapp , (0.8 , 0.8 ), CLICK , mod )
127+ mouse_event_at_relative_plot_pos (win , (0.8 , 0.8 ), CLICK , mod )
138128 assert len (tool .get_coordinates () or ()) == 2
139129
140- mouse_event_at_relative_plot_pos (win , qapp , (0.7 , 0.5 ), CLICK , mod )
130+ mouse_event_at_relative_plot_pos (win , (0.7 , 0.5 ), CLICK , mod )
141131 assert len (tool .get_coordinates () or ()) == 3
142132
143- mouse_event_at_relative_plot_pos (win , qapp , (0.1 , 0.1 ), CLICK )
133+ mouse_event_at_relative_plot_pos (win , (0.1 , 0.1 ), CLICK )
144134 assert len (tool .get_coordinates () or ()) == 1
145135
146136 coor = tool .get_coordinates ()
@@ -155,7 +145,7 @@ def test_select_points_tool():
155145
156146def test_edit_point_tool ():
157147 """Test the edit point tool for a CurveItem."""
158- with qt_app_context (exec_loop = False ) as qapp :
148+ with qt_app_context (exec_loop = False ):
159149 win , tool = create_window (EditPointTool )
160150 win .show ()
161151 curve_item : CurveItem = win .manager .get_plot ().get_active_item () # type: ignore
@@ -177,11 +167,11 @@ def test_edit_point_tool():
177167 min_v , max_v = 0 , 1
178168 x_path = np .full (n , min_v )
179169 y_path = np .linspace (max_v , min_v , n )
180- drag_mouse (win , qapp , x_path , y_path )
170+ drag_mouse (win , x_path , y_path )
181171
182172 x_path = np .full (n , max_v )
183173
184- drag_mouse (win , qapp , x_path , y_path )
174+ drag_mouse (win , x_path , y_path )
185175 curve_changes = tool .get_changes ()[curve_item ]
186176
187177 x_arr , y_arr = curve_item .get_data ()
@@ -196,9 +186,7 @@ def test_edit_point_tool():
196186 assert x_arr is not None and y_arr is not None
197187
198188 # Reset the arrays and deletes the changes
199- keyboard_event (
200- win , qapp , QC .Qt .Key .Key_Z , QC .Qt .KeyboardModifier .ControlModifier
201- )
189+ keyboard_event (win , QC .Qt .Key .Key_Z , QC .Qt .KeyboardModifier .ControlModifier )
202190
203191 assert len (curve_changes ) == 0
204192
@@ -207,7 +195,7 @@ def test_edit_point_tool():
207195 assert np .allclose (orig_x , restored_x )
208196 assert np .allclose (orig_y , restored_y )
209197
210- mouse_event_at_relative_plot_pos (win , qapp , (0.5 , 0.5 ), CLICK )
198+ mouse_event_at_relative_plot_pos (win , (0.5 , 0.5 ), CLICK )
211199 tool .trigger_insert_point_at_selection ()
212200
213201 new_x , new_y = curve_item .get_data ()
0 commit comments