@@ -18,13 +18,19 @@ class TestOWScatterPlot(WidgetTest, WidgetOutputsTestMixin):
1818 def setUpClass (cls ):
1919 super ().setUpClass ()
2020 WidgetOutputsTestMixin .init (cls )
21+ cls .same_input_output_domain = False
2122
2223 cls .signal_name = "Data"
2324 cls .signal_data = cls .data
2425
2526 def setUp (self ):
2627 self .widget = self .create_widget (OWScatterPlot )
2728
29+ def _compare_selected_annotated_domains (self , selected , annotated ):
30+ # Base class tests that selected.domain is a subset of annotated.domain
31+ # In scatter plot, the two domains are unrelated, so we disable the test
32+ pass
33+
2834 def test_set_data (self ):
2935 # Connect iris to scatter plot
3036 self .send_signal (self .widget .Inputs .data , self .data )
@@ -154,6 +160,9 @@ def test_group_selections(self):
154160 def selectedx ():
155161 return self .get_output (self .widget .Outputs .selected_data ).X
156162
163+ def selected_groups ():
164+ return self .get_output (self .widget .Outputs .selected_data ).metas [:, 0 ]
165+
157166 def annotated ():
158167 return self .get_output (self .widget .Outputs .annotated_data ).metas
159168
@@ -163,6 +172,7 @@ def annotations():
163172 # Select 0:5
164173 graph .select (points [:5 ])
165174 np .testing .assert_equal (selectedx (), x [:5 ])
175+ np .testing .assert_equal (selected_groups (), np .zeros (5 ))
166176 sel_column [:5 ] = 1
167177 np .testing .assert_equal (annotated (), sel_column )
168178 self .assertEqual (annotations (), ["No" , "Yes" ])
@@ -171,6 +181,7 @@ def annotations():
171181 with self .modifiers (Qt .ShiftModifier ):
172182 graph .select (points [5 :10 ])
173183 np .testing .assert_equal (selectedx (), x [:10 ])
184+ np .testing .assert_equal (selected_groups (), np .array ([0 ] * 5 + [1 ] * 5 ))
174185 sel_column [5 :10 ] = 2
175186 np .testing .assert_equal (annotated (), sel_column )
176187 self .assertEqual (len (annotations ()), 3 )
@@ -180,12 +191,14 @@ def annotations():
180191 sel_column = np .zeros ((len (self .data ), 1 ))
181192 sel_column [15 :20 ] = 1
182193 np .testing .assert_equal (selectedx (), x [15 :20 ])
194+ np .testing .assert_equal (selected_groups (), np .zeros (5 ))
183195 self .assertEqual (annotations (), ["No" , "Yes" ])
184196
185197 # Alt-select (remove) 10:17; we have 17:20
186198 with self .modifiers (Qt .AltModifier ):
187199 graph .select (points [10 :17 ])
188200 np .testing .assert_equal (selectedx (), x [17 :20 ])
201+ np .testing .assert_equal (selected_groups (), np .zeros (3 ))
189202 sel_column [15 :17 ] = 0
190203 np .testing .assert_equal (annotated (), sel_column )
191204 self .assertEqual (annotations (), ["No" , "Yes" ])
@@ -194,6 +207,7 @@ def annotations():
194207 with self .modifiers (Qt .ShiftModifier | Qt .ControlModifier ):
195208 graph .select (points [20 :25 ])
196209 np .testing .assert_equal (selectedx (), x [17 :25 ])
210+ np .testing .assert_equal (selected_groups (), np .zeros (8 ))
197211 sel_column [20 :25 ] = 1
198212 np .testing .assert_equal (annotated (), sel_column )
199213 self .assertEqual (annotations (), ["No" , "Yes" ])
@@ -205,6 +219,7 @@ def annotations():
205219 with self .modifiers (Qt .ShiftModifier | Qt .ControlModifier ):
206220 graph .select (points [35 :40 ])
207221 sel_column [30 :40 ] = 2
222+ np .testing .assert_equal (selected_groups (), np .array ([0 ] * 8 + [1 ] * 10 ))
208223 np .testing .assert_equal (annotated (), sel_column )
209224 self .assertEqual (len (annotations ()), 3 )
210225
0 commit comments